Command button properties
Posted on 2005-04-21
I have several command buttons which I need to set certain properties.
I already have some code that aligns the caption on the command button to the left, this is:
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
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)
lngOldValue = GetWindowLong(cmd_btn1.hWnd, GWL_STYLE)
SetWindowLong cmd_btn1.hWnd, GWL_STYLE, lngOldValue Or &H100
How do I set the background and foreground colours etc???
By simply typing "cmd_btn1.BackColor = RGB(148, 185, 226)", then I essentially overwrite what I have done in the above code and hence my caption returns to centre.
I don't really understand what GWL_STYLE is and I am assuming that I somehow have to incorporate my colour scheme using this method somehow?
Any help would be great!!!