如何改变窗口标题栏的高度、字体等?(50分)

  • 主题发起人 主题发起人 吴优
  • 开始时间 开始时间

吴优

Unregistered / Unconfirmed
GUEST, unregistred user!
不用控件
 
处理 WM_NC..消息。<br>在 WM_NCCALCSIZE 中改变标题栏高度。<br>在 WM_NCPAINT 中 使用自己的字体绘制。
 
能详细些吗?
 
看下面这段程序,千堆雪的[:D]<br><br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Label1: TLabel;<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; &nbsp; procedure WMNCPAint(var Mes : TWMNCPaint); message WM_NCPAINT;<br>&nbsp; &nbsp; procedure WMNCACTIVE(var msg: TMessage); message WM_NCACTIVATE;<br><br>procedure Paint_Caption;<br><br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br>var<br>&nbsp; State:Integer;<br><br>procedure TForm1.WMNCPAint(var Mes : TWMNCPaint);<br>begin<br>&nbsp; inherited;<br>&nbsp; Paint_Caption;<br>end;<br><br>procedure TForm1.Paint_Caption;<br>var<br>&nbsp; ACanvas : TCanvas;<br>begin<br><br>&nbsp; ACanvas := TCanvas.Create;<br>&nbsp; try<br>&nbsp; &nbsp; ACanvas.Handle := GetWindowDC(Form1.Handle);<br>&nbsp; &nbsp; with ACanvas do begin<br>&nbsp; &nbsp; &nbsp; if State=1 then<br>&nbsp; &nbsp; &nbsp; &nbsp; Brush.Color := &nbsp;clActiveCaption<br>&nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; Brush.Color := &nbsp;clInactiveCaption;<br><br>&nbsp; &nbsp; &nbsp; Font.Name := 'Times New Roman';<br>&nbsp; &nbsp; &nbsp; Font.Size := 12;<br>&nbsp; &nbsp; &nbsp; Font.Color := clYellow;<br>&nbsp; &nbsp; &nbsp; Font.Style := [fsBold];<br><br>&nbsp; &nbsp; &nbsp; TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height))/2) +1,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '抄袭千堆雪');<br>&nbsp; &nbsp; end;<br>&nbsp; finally<br>&nbsp; &nbsp; ReleaseDC(Form1.Handle, ACanvas.Handle);<br>&nbsp; &nbsp; ACanvas.Free;<br>&nbsp; end;<br>end;<br><br>procedure TForm1.WMNCACTIVE(var msg: TMessage);<br>begin<br>&nbsp; inherited;<br>&nbsp; State:=msg.WParam;<br>&nbsp; Paint_Caption;<br>end;<br><br>end.
 
那标题栏高度呢?
 
后退
顶部