Ver Mensaje Individual
  #1  
Antiguo 27-03-2014
Parsec Parsec is offline
Miembro
 
Registrado: abr 2006
Posts: 143
Reputación: 19
Parsec Va por buen camino
Funcion OndrawTab funciona dependiendo del PC

Hola,

Pongo la propiedad OwnerDraw del PageControl en true y pongo el siguiente código en su evento OnDrawTab:


Código Delphi [-]
procedure TForm1.PageControl1DrawTab(
  Control: TCustomTabControl;
  TabIndex: Integer; const Rect: TRect; Active: Boolean);
var
  R: TRect;
  Texto: String;

begin
  if Active then
  begin
    Control.Canvas.Font.Color := clRed;
    Control.Canvas.Font.Style := [fsBold];
  end;

  Texto := PageControl1.Pages[TabIndex].Caption;

  R := Rect;
  Control.Canvas.FillRect(R);

  if not Active then
    InflateRect(R, 0, -3);

  DrawText(
    Control.Canvas.Handle, PChar(Texto), -1, R,
    DT_SINGLELINE or DT_CENTER or DT_VCENTER);
end;

En mi portátil funciona perfectamente, lo llevo al PC del cliente y no funciona, muestra las pestañas en blanco.
He comprobado que cuando abre el formulario Form1.Show en mi portátil ejecuta la función OndrawTab y en el PC del cliente no pasa por ella, como si no existiese.

¿Alguien me puede explicar que sucede?
Muchas gracias
Responder Con Cita