All forms can be moved using the mouse

Source: Internet
Author: User

The easiest way to do this is to "cheat" the system so that he thinks it's the header row of the form

.

Unit Dragmain
Interface
uses
Sysutils, Wintypes, Winprocs, Messages, Classes, Graphics, controls,< br> Forms, Dialogs, Stdctrls;
Type
TForm1 = Class (Tform)
Button1:tbutton
Procedure Button1Click (sender:tobject);
Private
PR Ocedure 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" Client area?}
M.result: = htcaption; {If so, make Windows?
{on the caption bar.}
End;
Procedure Tform1.button1click (sender:tobject);
Begin
Close,
end,
end.
{The following is the form's settings}
Object Form1:tform1
Left = 203
top = bordericons
= []
BorderStyle = bsnone
ClientHeight = 273
ClientWidth = 427
Font.Color = clwindowtext
Font.height = -13
FoNt. Name = System
Font.style = []
PixelsPerInch =
TextHeight = +
Object Button1:tbutton
Left = 160
top =
Width = $
Height = Caption
= Close
TabOrder = 0
OnClick = Button1Click
End
End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.