Change Toolbutton Width and Heigh
Posted on 2000-01-14
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);
ImageList1.handle := ShGetFileInfo(PChar('c:\windows\notepad.exe'), 0, SHFileInfo, SizeOf(SHFileInfo), SHGFI_SMALLICON or SHGFI_SYSICONINDEX or SHGFI_ICON);
Toolbar1.ShowCaptions := False;
procedure TForm1.Button2Click(Sender: TObject);
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';
procedure TForm1.Button3Click(Sender: TObject);
ToolButton1.Width := 80;
ToolButton1.Height := 80;
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!