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