Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi







Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (0)


Adjust a TWinControl's size on RunTimeFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
N/A
Skill Level:
Scoring:
Last Update:
01/24/2003
Search Keys:
delphi delphi3000 article borland vcl code-snippet TWinControl/Perform/RunTime
Times Scored:
2
Visits:
1788
Uploader: quark quark
Company:
Reference: N/A
 
Question/Problem/Abstract:
Adjust a TWinControl's size on RunTime
Answer:



procedure ManipulateControl(WinControl: TWinControl; Shift: TShiftState; X, Y, Precision: integer);
var SC_MANIPULATE: Word;
begin
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is left of TWinControl***********************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X<=Precision) and (Y>Precision) and (Y  begin
    SC_MANIPULATE  := $F001;
    WinControl.Cursor := crSizeWE;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is Right of TWinControl**********************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X>=WinControl.Width-Precision) and (Y>Precision) and (Y  begin
    SC_MANIPULATE  := $F002;
    WinControl.Cursor := crSizeWE;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is Top of TWinControl************************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X>Precision) and (X  begin
    SC_MANIPULATE  := $F003;
    WinControl.Cursor := crSizeNS;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is left and Top of TWinControl***************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X<=Precision) and (Y<=Precision) then
  begin
    SC_MANIPULATE  := $F004;
    WinControl.Cursor := crSizeNWSE;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is right and Top of TWinControl**************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X>=WinControl.Width-Precision) and (Y<=Precision) then
  begin
    SC_MANIPULATE  := $F005;
    WinControl.Cursor := crSizeNESW ;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is bottom of TWinControl*********************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X>Precision) and (X=WinControl.Height-Precision) then
  begin
    SC_MANIPULATE  := $F006;
    WinControl.Cursor := crSizeNS;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is left and bottom of TWinControl************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X<=Precision) and (Y>=WinControl.Height-Precision) then
  begin
    SC_MANIPULATE  := $F007;
    WinControl.Cursor := crSizeNESW;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is right and bottom of TWinControl***********************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X>=WinControl.Width-Precision) and (Y>=WinControl.Height-Precision) then
  begin
    SC_MANIPULATE  := $F008;
    WinControl.Cursor := crSizeNWSE;
  end else
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  //Cursor is ClientRect of TWinControl*****************************************
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if (X>Precision) and (Y>Precision) and (X  begin
    SC_MANIPULATE  := $F009;
    WinControl.Cursor := crSizeAll;
  end else
  begin
    SC_MANIPULATE := $F000;
    WinControl.Cursor := crDefault;
  end;
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if Shift=[ssLeft] then
  begin
    ReleaseCapture;
    WinControl.Perform(WM_SYSCOMMAND, SC_MANIPULATE, 0);
  end;
end;


example:

(OnMouseMove Event)

procedure TForm1.MoveWinControl(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  ManipulateControl(Sender as TWinControl, Shift, X, Y, 5);
end;





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment













 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
C.A. Longen
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)