|
-
Oct 20th, 2024, 12:44 PM
#1
Strange Coloring
I have a custom control that consists of a textbox and two buttons. There is a grid of these controls in the program. In the control, I have this property:
Code:
Public Overrides Property ForeColor As System.Drawing.Color
Get
Return tbEntry.ForeColor
End Get
Set(value As System.Drawing.Color)
tbEntry.ForeColor = value
bComment.ForeColor = Drawing.Color.Black
bMark.ForeColor = Drawing.Color.Black
End Set
End Property
The intention is that when a certain action happens, the forecolor of the textbox changes color. In practice, it will either change to red or black.
My question is about the two lines that change the fore colors of the two buttons. If those lines are there, all is well, if those lines are not there, a very peculiar thing is happening: After the action that causes the textbox forecolor to become red, if I then move the mouse over the grid, some number of buttons will change their forecolor to red. After a few buttons have changed color (1-5, perhaps), the effect will end. The buttons that will change color need not be in any way related to the control that changed to red.
There is no code in the program that will change the forecolor of the buttons, as they are supposed to remain black at all times. Just to be sure, I've looked for all instances of Red, and all instances of ForeColor (all of which are shown in that code snippet). I also confirmed that the call to the ForeColor property of the user control is not called when it shouldn't be, though the buttons that get colored are whatever the mouse moves over, and need not be the control that got colored.
I suspect that the key point in that property is that the final line is setting a color to black, and that somehow the mouse is causing some strange painting issue such that it paints the forecolor to whatever the last color used was, but that's absurd. It just happens to fit the behavior.
Can anybody explain what is going on?
My usual boring signature: Nothing
 
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
|