SplitButton doesn't do background color [solved]
-
I have a splitbutton toolbar control that doesn't seem to work right. The BackColor property can be set and read, but doesn't show up on the control itself. I have an image with transparency, and no matter which way I change the backcolor (programmatically or in the properties), it uses the regular control color. I even checked the designer code, and the color is there. Anyway, I'm trying to implement the last chosen color for font and hiliting (the way Word/Wordpad does for their controls. Thought I'd try the background color first. Does anyone know of any code to alter a portion of the image itself? I know there's the wordpad sample, but it's a variety of C. Maybe I can convert it (if I can find it)
modified on Saturday, March 13, 2010 5:09 PM
-
I have a splitbutton toolbar control that doesn't seem to work right. The BackColor property can be set and read, but doesn't show up on the control itself. I have an image with transparency, and no matter which way I change the backcolor (programmatically or in the properties), it uses the regular control color. I even checked the designer code, and the color is there. Anyway, I'm trying to implement the last chosen color for font and hiliting (the way Word/Wordpad does for their controls. Thought I'd try the background color first. Does anyone know of any code to alter a portion of the image itself? I know there's the wordpad sample, but it's a variety of C. Maybe I can convert it (if I can find it)
modified on Saturday, March 13, 2010 5:09 PM
Figured out how to alter an existing image. Pretty simple really. This colors the last 4 lines of the image itself. This of course only works for a 16 x 16 image, but can easily be changed for different placement and image size. Since I have 2 controls in 3 different places, I just do:
instance.Image = ColorImage(instance.Image, newColor) Private Function ColorImage(ByRef theImage As System.Drawing.Bitmap, \_ ByRef theColor As System.Drawing.Color) \_ As System.Drawing.Bitmap Dim x, y As Integer For y = 12 To 15 For x = 0 To 15 theImage.SetPixel(x, y, theColor) Next Next ColorImage = theImage End Function