Change Toolbutton Width and Heigh

Hi, there should has someone ask about this, but I still need do understand it.

There is a toolbar,  toolbutton, get an icon of a file, 16X16, and 32X32. When in 32 mode, I would like it is large size button, and with Caption on it. When in 16 mode,  the button should be small and no caption.

Test code as follow:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ImageList1.handle := ShGetFileInfo(PChar('c:\windows\notepad.exe'), 0, SHFileInfo, SizeOf(SHFileInfo), SHGFI_SMALLICON or  SHGFI_SYSICONINDEX or SHGFI_ICON);
Toolbar1.ShowCaptions := False;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ImageList1.handle := ShGetFileInfo(PChar('c:\windows\notepad.exe'), 0, SHFileInfo,
SizeOf(SHFileInfo), SHGFI_LARGEICON or  SHGFI_SYSICONINDEX or SHGFI_ICON);
Toolbar1.ShowCaptions := True;
Toolbutton1.Caption := 'ToolButton1';
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
ToolButton1.Width := 80;
ToolButton1.Height := 80;
end;


Q1. How can I change the Toolbutton size?  And how can I prevent Toolbutton stupid change itself?.

Q2. If Q1 can not be solve with easy way, is there any other sugestion? (Please no 3rd party component, if posible)

Q3. Sometime I lost all icon on Windows system (ShareImage in ImageList already set true.). Is there something I should do to prevent the icon lost?

Sorry, want to leave some point for more question, hope 30 is not too less.

Thanks for your help!

Best Regards!

y9y
y9yAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

y9yAuthor Commented:
..Am I ask a stupid question?

....Or the question is so tough that no one can give me a sugestion?

....Or the qustion need more point?

....Or everyone leave for weekend?

Why no comment for this question? Have a nice weekend...

y9y


0
hubdogCommented:
 toolbar1.Perform(TB_SETBUTTONSIZE, 0, MakeLParam(50, 50));

this can change toolbuttonsize ignore the default behavior of borland control

please help me to write a paper of love mm step by step.

look forward to your paper.

hubdog
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
y9yAuthor Commented:
Thanks for your answer.


mm is trouble, and you will have touble too. good luck
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.