Solved

Move and resize a button

Posted on 2000-05-04
18
305 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
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!

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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