请问如何(可否)修改一个窗体的Title栏的默认颜色?(21分)

  • 主题发起人 主题发起人 ynduanlian
  • 开始时间 开始时间
Y

ynduanlian

Unregistered / Unconfirmed
GUEST, unregistred user!
有一种办法是让一个没有标题栏的的窗口(BorderStyle=bsNone)加上Panel也可以实现相同效果,但如何让让用户调整窗体的大小?<br>当窗体设置为BorderStyle=bsNone后,窗体的大小在运行时对用户就不可变了,可否让一个没有标题栏的的窗口(BorderStyle=bsNone)也可以让用户调整窗体的大小?
 
unit Unit14;<br><br>interface<br><br>uses<br>&nbsp;Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp;Dialogs;<br><br>type<br>&nbsp;TForm1 = class(TForm)<br>&nbsp; &nbsp;procedure FormCreate(Sender: TObject);<br>&nbsp;private<br>&nbsp; &nbsp;{ Private declarations }<br>&nbsp; &nbsp;procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;<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><br>{ TForm1 }<br><br>procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);<br>var<br>&nbsp;hDC: DWORD;<br>&nbsp;hBr: DWORD;<br>&nbsp;rc: &nbsp;TRect;<br>begin<br>&nbsp;hDC := GetDCEx(Handle, 0, DCX_WINDOW);<br>&nbsp;hBr := GetStockObject(GRAY_BRUSH);<br>&nbsp;GetWindowRect(Handle, rc);<br>&nbsp;FillRect(hDC, rc, hBr);<br>&nbsp;ReleaseDC(Handle, hDC);<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>var<br>&nbsp;dwStyle: DWORD;<br>begin<br>&nbsp;dwStyle := GetWindowLong(Handle, GWL_STYLE);<br>&nbsp;SetWindowLong(Handle, GWL_STYLE, dwStyle xor WS_CAPTION xor WS_SYSMENU);<br>end;<br><br>end.<br>
 
多人接受答案了。
 
后退
顶部