Solved

form with anywhere drag properties

Posted on 2002-04-24
6
163 Views
Last Modified: 2010-04-04
How can I create a form that I can click and drag anywhere on it's surface, not just on the caption bar?
Thanks,
Paul
0
Comment
Question by:annas
6 Comments
 
LVL 5

Accepted Solution

by:
Gwena earned 100 total points
ID: 6967064
Hi :-)

  For easy questions always try this delphi search

sitehttp://www.jounlai.com/3kdt/index.cgi


Here is a link to the info you need... I got it from the search page :-)


http://delphi.about.com/library/weekly/aa061300a.htm


There were a bunch more links... just search using 'drag'

0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6967334
I use :

procedure TForm1.MouseDown(...);
begin
  ReleaseCapture;
  SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
end;

the idea is to 'trick' the window we're holding it by it's caption bar
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6967792
well, my version

unit moving_whole_form_u;

interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 StdCtrls;

type
 TForm1 = class(TForm)
   CheckBox1: TCheckBox;
 private
   procedure WMNCHitTest(var Message : TWMNCHitTest); message WM_NCHITTEST;
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMNCHitTest(var Message : TWMNCHitTest);
begin
 inherited;
 if checkbox1.checked then  //Moving Toggle on/off check
   if message.result = HTCLIENT then //client-area
     message.result := HTCAPTION;  //do so if the caption is clicked
end;

end.


meikl ;-)
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6967793
gwena's second link is a good one :-)
0
 

Author Comment

by:annas
ID: 6967848
Yes that Worked Thanks Gwena and thanx for the search sitre!
Paul :)
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6968753
Your welcome annas :-)

That search site has helped me out a lot!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question