Ver Mensaje Individual
  #4  
Antiguo 28-05-2008
Avatar de Red_Leon
Red_Leon Red_Leon is offline
Miembro
 
Registrado: oct 2007
Ubicación: Castilla la Mancha
Posts: 27
Reputación: 0
Red_Leon Va por buen camino
Tienes que poner la propiedad ownerdraw a true y en el evento ondrawTab un codigo como este

Código Delphi [-]
{Evento 'OnDrawTab' del PageControl, el cual se encarga de colorear las pestáñas}
procedure TForm.PageControlDrawTab(Control: TCustomTabControl;
  TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
  AText: string;
  APoint: TPoint;
begin
  with (Control as TPageControl).Canvas do
  begin
    {Color con el cual lo coloreara}
    if(active) then
    begin
      Brush.Color := rojo;
    end
    else
    begin
      Brush.Color := verde;
    end;
    FillRect(Rect);
    {Texto que se insertara en la pestaña}
    AText := TPageControl(Control).Pages[TabIndex].Caption;
    {Se colorea la pestana}
    with Control.Canvas do
    begin
      APoint.x := (Rect.Right - Rect.Left) div 2 - TextWidth(AText) div 2;
      APoint.y := (Rect.Bottom - Rect.Top) div 2 - TextHeight(AText) div 2;
      TextRect(Rect, Rect.Left + APoint.x, Rect.Top + APoint.y, AText);
    end;
  end;
end;

Última edición por dec fecha: 19-09-2008 a las 15:38:20.
Responder Con Cita