我做了一个简单的例子,效果见附件,代码如下:
procedure TPanel.WMNCCalcSize(var Message: TWMNCCalcSize);
begin
inherited;
with Message.CalcSize_Params^ do
begin
rgrc[0].Top := rgrc[0].Top + 20;
end;
end;
procedure TPanel.WMNCPaint(var Message: TMessage);
var
OldDC: HDC;
DC: HDC;
begin
OldDC := Canvas.Handle;
DC := GetWindowDC(Handle);
try
Canvas.Handle := DC;
Canvas.Rectangle(Rect(0, 0, ClientWidth, 20));
Canvas.TextRect(Rect(0, 0, ClientWidth, 20), 2, 4, 'This is Caption');
finally
Canvas.Handle := OldDC;
ReleaseDC(Handle, DC);
end;
end;
Image Attachment:
[设计和运行效果]
剪贴板01.jpg (2007-7-25 10:39, 21.16 K)
|