BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

re-size of buttons

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Christopher
Guest





PostPosted: Fri Aug 19, 2005 2:40 am    Post subject: re-size of buttons Reply with quote



hi
is there a way to resize a button during run-time, the same way as during
design time? Please advise

thanks
chris


Back to top
Nicholas Sherlock
Guest





PostPosted: Fri Aug 19, 2005 3:20 am    Post subject: Re: re-size of buttons Reply with quote



Christopher wrote:
Quote:
hi
is there a way to resize a button during run-time, the same way as during
design time? Please advise

button1.width:=240;
button1.height:=5;

Cheers,
Nicholas Sherlock

Back to top
Peter Below (TeamB)
Guest





PostPosted: Fri Aug 19, 2005 9:12 am    Post subject: Re: re-size of buttons Reply with quote



In article <4305467c$1 (AT) newsgroups (DOT) borland.com>, Christopher wrote:
Quote:
is there a way to resize a button during run-time, the same way as during
design time? Please advise

You mean with the mouse interactively, i assume. Here are a couple of links,
some of which may actually still work <g>:

TStretchHandle http://www.torry.ru/index.htm, at the Authors's
page under S for Scott, Anthony.
TControlSizer
http://community.borland.com/homepages/dsp/index.htm
http://www.simes.clara.co.uk/delphi/ctrlsize.htm
DDH by Marco Cantu has an example,
download DDh3Code.zip from
http://www.marcocantu.com/ddh/default.htm
Part II, Chapter 8 "Advanced Window Components",
DdhSizer.pas. And how to use it ..SizeCompSizeDemo.dpr.
TSizeControl http://rpi.net.au/~ajohnson/delphi/


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Heinrich Wolf
Guest





PostPosted: Fri Aug 19, 2005 2:05 pm    Post subject: Re: re-size of buttons Reply with quote

Hi,

here is an example:
Keep the left Mouse Button for clicking the Button on the screen.
Use the right Mouse Button for stretching the Button on the screen.

Regards
Heiner

unit Main;

interface

uses
Windows,
Messages,
SysUtils,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls;

type
TMainForm = class(TForm)
MyButton : TButton;
procedure MyButtonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MyButtonMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
procedure MyButtonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
private
StartX,
StartY,
StartHeight,
StartWidth : Integer;
end;

var
MainForm: TMainForm;

implementation

{$R *.DFM}

procedure TMainForm.MyButtonMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbRight then
begin
StartX := X;
StartY := y;
StartHeight := MyButton.Height;
StartWidth := MyButton.Width;
end;
end;

procedure TMainForm.MyButtonMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if StartX >= 0 then
begin
MyButton.Height := StartHeight + Y - StartY;
MyButton.Width := StartWidth + X - StartX;
end;
end;

procedure TMainForm.MyButtonMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
StartX := -1;
end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
StartX := -1;
end;

end.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.