Colly321
asked on
Command button properties
Hi there
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.hWn d, 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!!!
Cheers
Andy
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.hWn
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!!!
Cheers
Andy
ASKER
Nah thats not it - it allows me to change the colours etc, but I no longer can set the caption to be left justified???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi edwardiii
I think it comes down to either:
1. Colouring the background and accepting the caption is going to be aligned centre
or
2. Aligning the caption left, and accepting the standard windows colour.
I personally don't want to create images, which although they may look nice, they create more work in the long run, especially if the text needs changing on them?
Your 2 links aren't really what I want?
Cheers
Andy
I think it comes down to either:
1. Colouring the background and accepting the caption is going to be aligned centre
or
2. Aligning the caption left, and accepting the standard windows colour.
I personally don't want to create images, which although they may look nice, they create more work in the long run, especially if the text needs changing on them?
Your 2 links aren't really what I want?
Cheers
Andy
A third option, with the (http://www.lebans.com/cmdbutton.htm) link as an example, is to obtain a third-party button code, which will allow you to do everything you want. Short of third-party code, you may be able to get the ForeColor API to work in tandem with your existing Left-alignment code, but setting BackColor hasn't been addressed at all.
Leave this post up for a while; another expert may provide exactly what you need. You may even contact the page admin (bingie) to verify. But thus far, everything I'm scanning online seems to indicate the fastest, easiest way to get what you want is to acquire a third-party solution as with lebans.com:)
Leave this post up for a while; another expert may provide exactly what you need. You may even contact the page admin (bingie) to verify. But thus far, everything I'm scanning online seems to indicate the fastest, easiest way to get what you want is to acquire a third-party solution as with lebans.com:)
www.fpoint.com
USe there command buttons. Anything you can ever dream of doing with a button is there.
USe there command buttons. Anything you can ever dream of doing with a button is there.
Here are a few excellent free XP controls that I use and the command button is too good. You can give it an XP or a classic look as well:
http://home.pages.at/vbmaster/Downloads.html
http://www.innovasys.com/
http://home.pages.at/vbmaster/Downloads.html
http://www.innovasys.com/
ASKER
Hi guys
Thanks for all your help, I have pretty much given up on this - there are ways to do both my requests, but it is pretty tricky to acheive both.
I think that the best way to think about it is to remember that it is a Windows program - not a Director style CD-ROM!!!!
My clients like the fancy graphics etc which I think is not always the best method of doing things!!!
Cheers
Andy
Thanks for all your help, I have pretty much given up on this - there are ways to do both my requests, but it is pretty tricky to acheive both.
I think that the best way to think about it is to remember that it is a Windows program - not a Director style CD-ROM!!!!
My clients like the fancy graphics etc which I think is not always the best method of doing things!!!
Cheers
Andy
1 -Graphical
and try