delphi6能不能在标题栏加入按钮 delphi7好像可以,但我用的是delphi6 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 D7可以?没有听说过。标题栏加入按钮只能自己写代码,关键是要处理WM_NC...消息族 当然可以了!unit Unit1;interfaceuses Windows, Buttons, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormResize(Sender: TObject); private { Private declarations } CaptionBtn:TRect; procedure DrawCaptButton; procedure WMNCPaint(var Msg:TWMNCPaint);message WM_NCPaint; procedure WMNCActivate(var Msg:TWMNCActivate);message WM_NCActivate; procedure WMSetText(var Msg:TWMSetText);message WM_SetText; procedure WMNCHitTest(var Msg:TWMNCHitTest);message WM_NCHittest; procedure WMNCLButtonDown(var Msg:TWMNCLButtonDown);message WM_NCLButtonDown; public { Public declarations } end;var Form1: TForm1;implementationconst htCaptionBtn=htSizeLast+1;{$R *.DFM}procedure TForm1.DrawCaptButton;var xFrame,yFrame,xSize,ySize:Integer; R:TRect;begin xFrame:=GetSystemMetrics(SM_CXFRAME); yFrame:=GetSystemMetrics(SM_CYFRAME); xSize:=GetSystemMetrics(SM_CXSIZE); ySize:=GetSystemMetrics(SM_CYSIZE); //按钮属性调整->> CaptionBtn:=Bounds(Width-xFrame-5*xSize+2,yFrame+2,xSize+13,ySize-4); Canvas.Handle:=GetWindowDC(Self.Handle); Canvas.Font.Name:='宋体'; Canvas.Font.Color:=clBlue; Canvas.Pen.Color:=clYellow; Canvas.Brush.Color:=clBtnFace; try DrawButtonFace(Canvas,CaptionBtn,1,bsAutoDetect,False,False,False); R:=Bounds(Width-xFrame-5*xSize+3,yFrame+3,xSize+10,ySize-7); with CaptionBtn do Canvas.TextRect(R,R.Left+2,R.Top,'TEST'); finally ReleaseDC(Self.Handle,Canvas.Handle); Canvas.Handle:=0; end;end;procedure TForm1.WMNCActivate(var Msg: TWMNCActivate);begininherited; DrawCaptButton;end;procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);begininherited; with Msg do if PtInRect(CaptionBtn,Point(xPos-Left,yPos-Top)) then Result:=htCaptionBtn;end;procedure TForm1.WMNCLButtonDown(var Msg: TWMNCLButtonDown);begininherited; if(Msg.HitTest=htCaptionBtn)then showmessage('good');end;procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);begininherited; DrawCaptButton;end;procedure TForm1.WMSetText(var Msg: TWMSetText);begininherited; DrawCaptButton;end;procedure TForm1.FormResize(Sender: TObject);begin Perform(WM_NCACTIVATE,Word(Active),0);end;end. 急求!!webservice访问出错 我的一个报表很怪,显示第一次提示字段没找到,再显示一次就正常了?? CxGrid如何用鼠标右键自由选择统计类型阿 IBQuery查询问题 那位老兄知道哪儿有DBTreeView的控件(提供源码),或有相关网站。 怎样使用自定消息在两个进程之间传播? 如何在delphi5中使用delphi6编写的源程序 请问打印怎么才能按照给定的页数范围进行打印,如从第3页到第8页? 各位大虾,请教一个问题,100分相送 什么地方有正式版KYLIX下载? 有关dbgrid的问题!不是太简单! 动态数组作为函数的参数传递问题
Windows, Buttons, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TForm1 = class(TForm)
procedure FormResize(Sender: TObject);
private
{ Private declarations }
CaptionBtn:TRect;
procedure DrawCaptButton;
procedure WMNCPaint(var Msg:TWMNCPaint);message WM_NCPaint;
procedure WMNCActivate(var Msg:TWMNCActivate);message WM_NCActivate;
procedure WMSetText(var Msg:TWMSetText);message WM_SetText;
procedure WMNCHitTest(var Msg:TWMNCHitTest);message WM_NCHittest;
procedure WMNCLButtonDown(var Msg:TWMNCLButtonDown);message WM_NCLButtonDown;
public
{ Public declarations }
end;var
Form1: TForm1;implementationconst
htCaptionBtn=htSizeLast+1;{$R *.DFM}procedure TForm1.DrawCaptButton;
var
xFrame,yFrame,xSize,ySize:Integer;
R:TRect;
begin
xFrame:=GetSystemMetrics(SM_CXFRAME);
yFrame:=GetSystemMetrics(SM_CYFRAME);
xSize:=GetSystemMetrics(SM_CXSIZE);
ySize:=GetSystemMetrics(SM_CYSIZE);
//按钮属性调整->>
CaptionBtn:=Bounds(Width-xFrame-5*xSize+2,yFrame+2,xSize+13,ySize-4);
Canvas.Handle:=GetWindowDC(Self.Handle);
Canvas.Font.Name:='宋体';
Canvas.Font.Color:=clBlue;
Canvas.Pen.Color:=clYellow;
Canvas.Brush.Color:=clBtnFace;
try
DrawButtonFace(Canvas,CaptionBtn,1,bsAutoDetect,False,False,False);
R:=Bounds(Width-xFrame-5*xSize+3,yFrame+3,xSize+10,ySize-7);
with CaptionBtn do
Canvas.TextRect(R,R.Left+2,R.Top,'TEST');
finally
ReleaseDC(Self.Handle,Canvas.Handle);
Canvas.Handle:=0;
end;
end;procedure TForm1.WMNCActivate(var Msg: TWMNCActivate);
begin
inherited;
DrawCaptButton;
end;procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
with Msg do
if PtInRect(CaptionBtn,Point(xPos-Left,yPos-Top)) then
Result:=htCaptionBtn;
end;procedure TForm1.WMNCLButtonDown(var Msg: TWMNCLButtonDown);
begin
inherited;
if(Msg.HitTest=htCaptionBtn)then
showmessage('good');
end;procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);
begin
inherited;
DrawCaptButton;
end;procedure TForm1.WMSetText(var Msg: TWMSetText);
begin
inherited;
DrawCaptButton;
end;procedure TForm1.FormResize(Sender: TObject);
begin
Perform(WM_NCACTIVATE,Word(Active),0);
end;end.