?
Solved

Move and resize a button

Posted on 2000-05-04
18
Medium Priority
?
309 Views
Last Modified: 2010-05-18
Hi,

   How can I move and resize a button in the form of my application just like in DELPHI's IDE? Do I need to use a third party package tools such as LMD tools to simplfy the programming for that?
0
Comment
Question by:zxw
[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
  • 4
  • 2
  • +5
18 Comments
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2777685
I have an example of moving a button at runtime on my webpage:

www.drdelphi.com



Good luck!!
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2777691
0
 
LVL 3

Expert Comment

by:shenqw
ID: 2777862
Here is your needs.

http://www1.experts-exchange.com/bin/Q.10335801

$F012=Dragging
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:d32coder
ID: 2778646
You can edit the TOP & LEFT properties of the button at runtime to move it.  These are pixels away from the top left corner of the owner (form or panel).

To resize it, change the HEIGHT & WIDTH properties, these are also pixel sizes.

for example,
  button1.width := 90;

  They are 75 pixels wide by default, if you use that line, it will be 90 pixels long instead.

 Cheers.
0
 

Author Comment

by:zxw
ID: 2779308
Sorry, I don't make me clear. I want to let the user to move and resize the button in my app just like I do in Delphi's IDE.
0
 

Author Comment

by:zxw
ID: 2779336
Mr. d32coder,

Would you so kind to give me a full example to move and resize a button by user at runtime ?
0
 

Author Comment

by:zxw
ID: 2779427
Adjusted points from 200 to 300
0
 

Author Comment

by:zxw
ID: 2779428
Sorry, I don't make me clear. I want to let the user to move and resize the button in my app just like I do in Delphi's IDE.

0
 
LVL 3

Expert Comment

by:shenqw
ID: 2779684
hi,zxw:
  Have you navigated that URL in my prior comment?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2779748
hi zxw,

just not as the delphi ide,
but maybe you can use it

var xx,yy : Integer;

//initial
procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (ssShift in Shift) or
     (ssCtrl  in Shift) then
  begin
    xx := x;
    yy := y;
  end;
end;

//action
procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if ssright in shift then    //only on right Button down
  begin
    if ssShift in Shift then   //shift -> move
    begin
      Button1.Left := Button1.Left + x - xx;
      Button1.Top := Button1.Top + y - yy;
    end;
    if ssctrl in Shift then   //control -> resize
    begin
      Button1.width := Button1.width + x - xx;
      Button1.height := Button1.height + y - yy;
      xx := x;
      yy := y;
    end;
  end;
end;

meikl

0
 

Expert Comment

by:aacrg
ID: 2779849
Have you already tried this?

procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  MyButton.Perform(WM_SYSCOMMAND, SC_MOVE+1, 0);
end;

procedure TForm1.Button2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  MyButton.Perform(WM_SYSCOMMAND, SC_SIZE+8, 0);
end;

Regards, aacrg.
0
 
LVL 1

Expert Comment

by:rowisoft
ID: 2780444
Hy!!

What you need is: TStretchHandle!!

Please search on DSP for it! - there is a silli weather (with lights, i dont know whats this in english), so I have to turn off my PC now...

TStretchHandle is free and with sourche!!

Robert Wismet
0
 
LVL 1

Expert Comment

by:rowisoft
ID: 2780534
I've found the downloadpath:
ftp://ftp.cdrom.com/pub/delphi_www/ftp/d10free/handles.zip

....and the weater is better... ;-)) - wasn't long... ;-))


Robert Wismet
http://www.rowisoft.de
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2782719
listenning
0
 
LVL 1

Accepted Solution

by:
rowisoft earned 1200 total points
ID: 2783449
Hy!

Whats about the TStretchHandle?? Do you need this??
....do I get my points... ;-)

Robert
0
 

Author Comment

by:zxw
ID: 2783508
Hi rowisoft ,

I spent a lot of time to download the file, but I can't! Is the url right?(Also on DSP I found the file, but the wrong url to download). Would you plz send the source file to me : shineway@yahoo.com

0
 

Author Comment

by:zxw
ID: 2783631
Thank you rowisoft. TStretchHandle is the exact one I wanted!

Thank everyone.
0
 
LVL 1

Expert Comment

by:rowisoft
ID: 2783652
Hello!

Nice to help you! - Thank you for the points!

Robert Wismet
0

Featured Post

Independent Software Vendors: 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

765 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