您现在的位置: 天极网 > 全部窗体可使用鼠标中移动

全部窗体可使用鼠标中移动

2000-01-30 00:00作者:-出处:CPCW责任编辑:

最简单的办法就是"欺骗"系统,让他认为点中的是窗体的标题行

unit Dragmain;

interface

uses

SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;

type

TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
begin
inherited; { call the inherited message handler }
if M.Result = htClient then { is the click in the client area? }
M.Result := htCaption; { if so, make Windows think its }
{ on the caption bar. }
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;



end.



{ 下面是这个窗体的设置}



object Form1: TForm1
Left = 203
Top = 94
BorderIcons = []
BorderStyle = bsNone
ClientHeight = 273
ClientWidth = 427
Font.Color = clWindowText
Font.Height = -13
Font.Name = System
Font.Style = []
PixelsPerInch = 96
TextHeight = 16
object Button1: TButton
Left = 160
Top = 104
Width = 89
Height = 33
Caption = Close
TabOrder = 0
OnClick = Button1Click
end
end

相关文章及产品
关注此文读者还看过
相关

科技万花筒

文章排行
本周
本月
最近更新
关于我们|About us|网站律师|天极服务|电子杂志|RSS订阅|加入我们|网站地图
TMG
Copyright (C) 1999-2009 Chinabyte.com, All Rights Reserved 版权所有 天极网络
商务联系、网站内容、合作建议:010-82657868
版权声明 在线提交意见反馈 渝ICP证B2-20030003号
经营性网站备案信息 网警备案 中国网站排名
天极传媒:天极网|比特网|IT专家网|IT商网|52PK游戏网|IT分众