Flat Button with BackColor

vbStudent
vbStudent used Ask the Experts™
on
i want to make buttons in to Flat Style but with Custome
Defined BackColor, although i could able to create Flat
Buttons, but i am not able to apply BackColor to the Flat
Buttons
if any one know how to Do this? plz help me out.


here is the Code

Public Const BS_FLAT = &H8000&
Public Declare Function SetWindowLong Lib "user32"
Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex
As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)

form_load()
     res = SetWindowLong(Command3.hwnd, GWL_STYLE,
BS_FLAT)
end sub



thanks in Advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I use a picturebox for such things.  It is easier to maintain and responds to click events.  Either way, if you want to continue down the path you are going with the API, you need to change:
   res = SetWindowLong(Command3.hwnd, GWL_STYLE,
BS_FLAT)

to a combination:
oldRes = GetWindowLong(command3.hwnd,GWL_STYLE)
   res = SetWindowLong(Command3.hwnd, oldRes
 AND GWL_STYLE,
BS_FLAT)
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Recommendation: Accept comment from Twalgrave

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

DominicCronin
EE Cleanup Volunteer
Commented:
The question is PAQ'd and points NOT refunded to the user.The answer is 2 months after the question.

AnnieMod
Community Support Moderator

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial