Solved

Move and resize a button

Posted on 2000-05-04
18
303 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 300 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

803 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