?
Solved

Change Toolbutton Width and Heigh

Posted on 2000-01-14
3
Medium Priority
?
1,436 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:y9y
  • 2
3 Comments
 

Author Comment

by:y9y
ID: 2356187
..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
 
LVL 2

Accepted Solution

by:
hubdog earned 120 total points
ID: 2356575
 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
 

Author Comment

by:y9y
ID: 2357785
Thanks for your answer.


mm is trouble, and you will have touble too. good luck
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…

588 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