|
-
Mar 28th, 2003, 08:56 AM
#1
Thread Starter
Member
Setting label backcolor in colde
Can anyone tell me why this bit of code does not change the background color of the label?
Label1.BackColor = Color.FromArgb(QBColor(Val(sender.tag)))
This line is executed from within an event procedure that is called when a button is clicked (it's actually a 4x4 matrix of buttons, each tagged with a number 0 to 15). I have viewed the result of the .FromArgb method in the debug window, and it returns the correct value for the corresponding QBColor, but for some reason it does not change the background color of the label. Am I missing something here (maybe using the Argb method incorrectly), is there another way of doing this, or ????????
--Steve
[email protected]
-
Mar 28th, 2003, 09:36 AM
#2
Frenzied Member
This is from MSDN:
argb
A value specifying the 32-bit ARGB value.
Return Value
The Color structure that this method creates.
Remarks
The byte-ordering of the 32-bit ARGB value is AARRGGBB. The most significant byte (MSB), represented by AA, is the alpha component value. The second, third, and fourth bytes, represented by RR, GG, and BB, respectively, are the color components red, green, and blue, respectively.
so in your method the 'alpha' value may be 0, so it wont have any effect.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Mar 28th, 2003, 10:00 AM
#3
Thread Starter
Member
I see that now - in the debug window, regardless of which button I click, the alpha value returned is '0', which I assume is transparent. So, now the question is, how do I change that alpha value to 255? Or would it be easier to use the tag for each button differently so that I didn't have to convert from a QBColor?
-
Mar 28th, 2003, 10:14 AM
#4
Frenzied Member
I think setting the tag to the color value would be less pain than converting.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Mar 28th, 2003, 10:36 AM
#5
Thread Starter
Member
Yes, this is true. Any suggestions for doing this automatically with a loop in code, or would it just be easier to set the tag property to the value by hand?
-
Mar 28th, 2003, 12:19 PM
#6
Sleep mode
Hmm , Why don't you use something similar to this :
VB Code:
Button1.BackColor = Drawing.Color.AnyColor
I think this would be less pain at least .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|