Topic: Button, Form Icon
Hello MVD
Is there any sample of script or project of button with a customized icon attached to the database.
Also script of form icon.
Please help!
Thanks!
My Visual Database → General → Button, Form Icon
Hello MVD
Is there any sample of script or project of button with a customized icon attached to the database.
Also script of form icon.
Please help!
Thanks!
Hi Manix,
One way is to use an image and associate it with a (hidden) button (please see attached).
Optionally, you can move the image slightly when you click down and click up so that it behaves like a button.
But I agree, it would be better if we could simply place a customised icon on a standard button.
Derek.
Wow This is nice derek. But all i wanted is inside of the buttons. please.
Yes, that's the problem.
It's not possible to overlay an icon (or any image) on top of a button - the button is always on top.
Derek.
I was also curious about customizing the icons available on the buttons. Not to be modified by a script or an overlay, but maybe a .dll file somewhere similar to how they're customized in Windows...
Any other options for this?
Hello Derek, Joshua,, Manixs2013
Until a solution similar to that of Windows (a DLL integrated in MVD), we can console ourselves with this piece of code :
var ImageList: TImageList;
begin
// On créée une nouvelle ImageList
ImageList:=TImageList.Create(Form1);
ImageList.Masked:=false;
ImageList.ColorDepth:=cd32bit;
ImageList.Width := 16; // Taille des images
ImageList.Height := 16;
// Chargement des images
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\key.png'); // 0 - index if image
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\accept.png'); // 1
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\link.png'); // 2
ImageList.AddPng(ExtractFilePath(Application.ExeName)+'Icons\window.png'); // 3
// Change ImageList for buttons
Form1.Button1.Images := ImageList;
Form1.Button2.Images := ImageList;
Form1.Button3.Images := ImageList;
Form1.Button4.Images := ImageList;
Form1.Button5.Images := ImageList;
Form1.Button6.Images := ImageList;
// Select images for buttons
Form1.Button1.ImageIndex := 0;
Form1.Button2.ImageIndex := 1;
Form1.Button3.ImageIndex := 2;
Form1.Button4.ImageIndex := 3;
Form1.Button5.ImageIndex := 3;
Form1.Button6.ImageIndex := 3;
end.
To place between BEGIN and END.
JB
Hi Jean, Joshua, Manixs,
If you want an image to appear as if it's inside a button, the only other way I could think of doing it is this (please see attached):
1. Use a panel with a bevel size of 1 (so that it looks like a 'blank' button).
2. Place an image inside the panel (the icon you want to display).
If you also want text associated with the icon, then
3. Optionally, place a text object inside the panel (the text you want to display).
4. Optionally, place a second label on top of the panel (NOT INSIDE the panel) and make this second label transparent.
Obviously, just an icon in the panel is pretty quick and straightforward, an icon plus text involves a couple of extra steps.
The script then simply moves the panel to mimic a button being pressed (and calls Form2). Because the script moves the panel, the objects within the panel (the icon and optionally, the text) also move because they are subordinate to the panel.
But if you have a lot of buttons where you want to use your own icons then I think Jean's script is a much better solution.
Regards,
Derek.
Thanks for sharing these methods folks- they are very clever alternatives.
Hi Guys,
Using Derek's solution with slight changes. Usually, that's what I use (workaround) when I want buttons with images (icon)
1. Changed bevel type to have different pressed effect by using 2 panels top each other
2. Added mouse over color to button when mouse moves over to the button label. It can be applied to whole panel (button) instead of just label.
My Visual Database → General → Button, Form Icon
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi