Solved

Move and resize a button

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

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now