In a Winforms application (C#2, FX2.0, VC2008) I am using a Panel derived Control to display custom controls. The controls are arranged vertically and there are usually more than fit in the visible area of the panel.
I have drawn a litte sketch of it:
Panel http://www.ericschaefer.org/Panel.png
Sometimes (usually after scrolling inside the panel) rectangular areas appear to have their colors inverted (green part in sketch). These areas are random in size but seem always to be at the right edge of the panel. As you can see in the sketch the arrow buttons of the panels scrollbar are also inverted, but not the thumbslider and the scroll area.
By inverted colors I mean black becomes white, white becomes black, blue becomes brown, etc…
I am out of ideas.
- Can this be caused by my application?
- Is it even possible to draw into the scrollbar arrow buttons?
- Any ideas?
EDIT: “Screenshot“
EDIT: I was wrong about the Panel. It has been a Panel in the past but it is now a UserControl. Like this:
public class MyPanel : UserControl
{
public MyPanel()
{
DoubleBuffered = true;
BorderStyle = BorderStyle.Fixed3D;
BackColor = Color.DarkBlue;
VScroll = true;
HScroll = false;
AutoScroll = true;
AutoScrollMargin = new Size( 0, 4 );
}
}
Solved:
Apparently it was the fault of the touch screen driver. I can now reproduce the behaviour. If you click the “scroll down” button on any scroll bar via touch screen and hold it down for a while it keeps scrolling when you release it (the button stays pushed). After that you can click whereever you want, there will always be the “inverted colors” on the left side of the scroll bar. It happens with any application (explorer.exe!). Now it gets even better: Generally in Windows if you drag a scroll bar thumb button you can drift off of the scroll bar if you keep the mouse button pressed. But if you drift away too far the button will snap back to its original position (where you started dragging). Try it! The inverted colors rectangles are exactly as wide as the area where you can drift off without the button snapping back. I don’t even try to understand this.
We installed a newer driver for the touch screen which does not keep scrolling even after you released the “scroll down” button and the issue disappeared. My blood pressure is back to normal but all the grey hair is probably not turning black I guess…
Thanks anyways…