Ver Mensaje Individual
  #1  
Antiguo 21-01-2012
rarratia rarratia is offline
Miembro
 
Registrado: sep 2004
Posts: 50
Reputación: 22
rarratia Va por buen camino
Cambiando aspecto del caption en barra de título

Tengo el siguiente problema: capturo el mensaje Paint y Activate de windows para mi ventana y poder modificar los atributos del caption de mi teform con los siguientes procedimientos privados:
Código Delphi [-]
procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
procedure WMNCActivate(var Msg: TWMNCActivate); message WM_NCACTIVATE;

Implemento estos procedimientos de la siguiente forma:

Código Delphi [-]
procedure Tf_main.WMNCPaint(var Msg: TWMNCPaint);
var
  Lienzo : TCanvas;
begin
  inherited;
  lienzo := TCanvas.Create;
  try
     lienzo.Handle := GetWindowDC(Self.Handle);
    with lienzo do
    begin
      Brush.Color := clActiveCaption;
      Font.Size := 12;
      TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER),
        Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height)) / 2) + 1, 'algún texto');
    end;
  finally
    ReleaseDC(Self.Handle, lienzo.Handle);
    lienzo.Free;
  end;
end;

procedure Tf_main.WMNCActivate(var Msg: TWMNCActivate);
var
  Lienzo : TCanvas;
begin
  inherited;
  lienzo := TCanvas.Create;
  try
    lienzo.Handle := GetWindowDC(Self.Handle);
    with lienzo do
    begin
      Brush.Color := clActiveCaption;
      Font.Size := 12;
      TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER),
        Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height)) / 2) + 1, ' Some Text');
    end;
  finally
    ReleaseDC(Self.Handle, lienzo.Handle);
    lienzo.Free;
  end;
end;

Esto que funciona bien en window xp, no me funciona en window 7 ¿Qué estará pasando? ¿Estoy olvidando algo? Por favor si alguien me ayuda para poder cambiar el tamaño de mi caption en el form. Gracias por anticipado
Responder Con Cita