View Full Version : Button Color in Forms


Phredd
07-22-2003, 11:07 PM
Guys,

Is there any simple way to change the BACKGROUND color of a button in a form from the standard grey to anything else.

Thanks

ColinEssex
07-23-2003, 12:41 AM
Have you done a search for this yet?

Mile-O
07-23-2003, 12:46 AM
No, but you can create a label that does the same job and customise that.

IMO
07-23-2003, 01:03 AM
Create an oblong the size of the button you'd like in something like Paint, colour it and save it as a .bmp. Insert it into your form, Insert >>> Picture. In the properties of the picture on the form, Change the Special Effect to raised. In the 'On Mouse Down' event type this code...

Private Sub YourImage_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Me.YourImage.SpecialEffect = 2

End Sub

YourImage being the name of the image. In the 'Mouse Up' event type...

Private Sub YourImage_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Me.YourImage.SpecialEffect = 1

End Sub


This will make any image look like a button.

Hope this helps

IMO

Phredd
07-23-2003, 03:12 PM
Mile-O-Phiile....

What was the trick to get the button to "Become Active".

I drew the shape etc, and started playing with "ON" events, but my button still thinks its a label.

Thanks guys, I think once I get this bit going I should be right.

Mile-O
07-24-2003, 12:43 AM
WHat do you mean become active?

I just used the MouseDown, MouseUp, and OnClick events.

If you are asking about the hand cursor appearing like a hyperlink, I put a space in the Hyperlink property.

Phredd
07-24-2003, 03:43 PM
I have said it before.....

This is the best place anywhere for getting quick and accurate responses to question.

Well done guys, and thanks