今天图老师小编给大家介绍下全部窗体可使用鼠标中移动,平时喜欢全部窗体可使用鼠标中移动的朋友赶紧收藏起来吧!记得点赞哦~
【 tulaoshi.com - 编程语言 】
最简单的办法就是"欺骗"系统,让他认为点中的是窗体的标题行
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)
unit Dragmain;interfaceusesSysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls;typeTForm1 = class(TForm)Button1: TButton;procedure Button1Click(Sender: TObject);privateprocedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;end;varForm1: TForm1;implementation{$R *.DFM}procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);begininherited; { 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);beginClose;end;end.{ 下面是这个窗体的设置}object Form1: TForm1Left = 203Top = 94BorderIcons = []BorderStyle = bsNoneClientHeight = 273ClientWidth = 427Font.Color = clWindowTextFont.Height = -13Font.Name = SystemFont.Style = []PixelsPerInch = 96TextHeight = 16object Button1: TButtonLeft = 160Top = 104Width = 89Height = 33Caption = CloseTabOrder = 0OnClick = Button1Clickendend(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)
来源:http://www.tulaoshi.com/n/20160219/1615198.html
看过《全部窗体可使用鼠标中移动》的人还看了以下文章 更多>>