Move and resize a button

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?
zxwAsked:
Who is Participating?
 
rowisoftCommented:
Hy!

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

Robert
0
 
DrDelphiCommented:
I have an example of moving a button at runtime on my webpage:

www.drdelphi.com



Good luck!!
0
 
DrDelphiCommented:
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
shenqwCommented:
Here is your needs.

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

$F012=Dragging
0
 
d32coderCommented:
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
 
zxwAuthor Commented:
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
 
zxwAuthor Commented:
Mr. d32coder,

Would you so kind to give me a full example to move and resize a button by user at runtime ?
0
 
zxwAuthor Commented:
Adjusted points from 200 to 300
0
 
zxwAuthor Commented:
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
 
shenqwCommented:
hi,zxw:
  Have you navigated that URL in my prior comment?
0
 
kretzschmarCommented:
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
 
aacrgCommented:
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
 
rowisoftCommented:
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
 
rowisoftCommented:
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
 
bryan7Commented:
listenning
0
 
zxwAuthor Commented:
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
 
zxwAuthor Commented:
Thank you rowisoft. TStretchHandle is the exact one I wanted!

Thank everyone.
0
 
rowisoftCommented:
Hello!

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

Robert Wismet
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.