Solved

form with anywhere drag properties

Posted on 2002-04-24
6
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 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