截获非客户区重画消息WM_NCPaint,自己画非客户区
解决方案 »
- delphi动态数组创建问题
- 如何消除PChar的WARNING??还有没有可以替换PChar的函数??
- 请问怎么把adoquery查询到的数据赋值给listbox控件?
- 誰有DELPHI5.0光碟資料,高分求助!!!!
- rave 問題至少100分,分不鉤可以再加
- 问一非DELPHI的问题,急需解决
- 动态创建ADOconnection,Adotable如何写代码呢?
- delphi 分页实现 adodataset access,解决马上给分 ,
- 大家谈谈找工作的经验吧~
- 怎样获取,shelltreeview 中所选节点的路径信息? 节点中的node.text是'本地磁盘(c)'而我要得到的是 c:\
- 如何在运行时查找发布的事件?
- 怎么样在一个Unit里给另外一个Unit里的变量付值
但_liangzi_() 可谓机智简洁,有意思。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject); private
{ Private declarations }
procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;
public
{ Public declarations }
end;var
Form1: TForm1;
Cap:String;
implementation{$R *.dfm}procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
var ACanvas: TCanvas;
intLeftShift, intTopShift: Integer;
begin
inherited; ACanvas := TCanvas.Create;
try
{to retrieve the device context for the Form1 window}
ACanvas.Handle := GetWindowDC(Form1.Handle);
with ACanvas do
begin
//Brush.Color := clNone ;//clActiveCaption;
SetBkMode(ACanvas.Handle,TRANSPARENT);
//Font.Style := [fsItalic];
Font.Color := clWhite;
Font.Style := [fsBold] ; {calculate the left coordinate for caption drawing}
intLeftShift := GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER);
{calculate the top coordinate for caption drawing}
intTopShift := (GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height)) div 2 + 1; {output the caption string}
TextOut(intLeftShift+200, intTopShift, Cap);
end;
finally
{to release the device context}
ReleaseDC(Form1.Handle, ACanvas.Handle);
ACanvas.Free
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Cap:=Caption;
Form1.Caption :='';
end;end.
这步是输出文字,至于在Caption的中间么,自己算一下吧