Anyone know how to put a small icon in a command button on the left of the text instead of centering it?
Printable View
Anyone know how to put a small icon in a command button on the left of the text instead of centering it?
Hi,
Hope you are using the graphical style command button right? Try adding the image and the text using the code instead of from the property sheet. I have not tried it as i dont have vb in my system, still i believe there must be some option for this.
Good Luck,
You could try creating a little GIF or something with the icon positioned to the left and the grey button colour to the right and then stick that onto your button.
This would make the icon appear left aligned. You'd have to put your text in the GIF as well though as VB won't overlay a caption over a graphic.
Mafro
One way of doing it is:
1 .Add a PictureBox with the required graphic.
2. Add your CommandButton with the required text.
3. Add spaces to the Caption of the CommandButton to allow for the graphic on the left hand side.
4. Put the PictureBox in the space you've created on the CommandButton. (Bring to front if necessary (CTRL-J).
Optional:
5. Add code to make the PictureBox move when the mouse button is pressed - so it looks like it's on the surface of the CommandButton instead of floating on top of it:
Eg: Picture1.Top = intPicture1YPos + intPixel
Picture1.Left = intPicture1XPos + intPixel
Where intPicture1XPos and intPicture1YPos are the original coordinates of the PictureBox and intPixel is Screen.TwipsPerPixelX (probably 15)
Then there's the easy way. All you have to do is open your component list (right click on toolbox, select Components) and select Microsoft Forms 2.0 Object Library. It will put a couple of controls on your toolbox, of wich one is a button. This button allows you to specify where you want the picture.
Simple :)
Nice one! :D