Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > Oracle Database, SQL, Application, Programming


Why always drag a window by its title bar?


Reply
Views: 1405  
Thread Tools Rate Thread
  #1  
Old 08-11-2010, 02:26 PM
bholas bholas is offline
Award Winner
 
Join Date: Apr 2010
Posts: 4,977
Default Why always drag a window by its title bar?

The most common way to move an application window is to drag it by its title (or caption) bar. If you want to give your users the ability to move your application by dragging it by clicking anywhere on your application window, here's what you can do:
  • Insert following two lines into your form's "Private declarations" section:


procedure WMNCHitTest( var Msg : TWMNCHitTest );
message wm_NCHitTest;
  • Add following code into the "implementation" section of your form's unit (assuming that your form is named Form1):


procedure TForm1.
WMNCHitTest( var Msg : TWMNCHitTest );
begin
inherited;
{ fool windows by telling it
that it's in our caption area
although it's in our client area }

if( htClient = Msg.Result )then
Msg.Result := htCaption;
end;

Reply With Quote
Reply

Tags
pc tips

New topics in Oracle Database, SQL, Application, Programming





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)