[RESOLVED] Random "notch" in my user-drawn control.
I have my control here, and when the control isn't drawing selected, it has a random notch in the border(as illustrated in the attached photo). It uses a graphics path which is generally used all around so nothing changes there. Other than the fact the control is marked "selected"(which only effects the colors).
Here's the code that generates my graphics path...
vbnet Code:
Private ReadOnly Property gp As GraphicsPath
Get
Dim output As New GraphicsPath
output.AddArc(New Rectangle(New Point(3, 2), New Size(20, 20)), 180, 80)
output.AddLine(New Point(2, Me.Height - 1), New Point(3, 10))
Return output
End Get
End Property
I'm hoping someone knows why this may be occurring.. It has happened before to but never was able to solve it.
Maybe if it was less noticeable I wouldn't care, but since the notch occurs in the middle of a dark gray section really makes it stick out like a sore thumb.
Last edited by DavesChillaxin; Jan 26th, 2012 at 01:08 PM.
Please rate if my post was helpful!
Per favore e grazie!
Using TabGradientBrush As New LinearGradientBrush(New Point(Me.Width \ 2, 0), New Point(Me.Width \ 2, Me.Height), Me.Skin.BaseColorHigh, Me.Skin.BaseColorLow)
@daves: The lines are clearly being drawn with anti-aliasing, so I guess there was no need to mention the SmoothingMode. GDI+ is sometimes less than perfect at anti-aliasing lines which are almost exactly vertical or horizontal, although I have never noticed gaps like the ones you are getting.
I think you need to look at how you define the path. The length of the base line and the ends of the arcs do not quite match, so that the sides are very slightly inclined. You could adjust your arithmetic to give sides which are exactly vertical. It might help if you draw the straight sides explicitly, so that you can see where the mismatch is. Alternatively, if you actually want sides which are slightly sloping, make the slope a bit more pronounced.
@i00: GDI+ does its antialiasing with single precision so there is normally no visible difference when the SmoothingMode is set appropriately.
BB
EDIT: I had to pick pieces out of the code so that I could try it out. At first I thought I could reproduce the problem but later not. Maybe I made a mistake about which smoothing mode I was using. Now it's clear that the GraphicsPath is as intended and the outline of the tab is always smooth, even when the sides are at a slight angle.
It's a remote possibility, but I wonder whether the problem is caused by drawing the tab image after the outline. In theory, there could be some stray pixels getting in front of the outline. It would be more logical anyway to draw the image before the outline.
Last edited by boops boops; Jan 27th, 2012 at 07:19 AM.
You know what? I just realized this is only occurring when I'm developing on an XP system(computer at work). I just checked now and none of the tabs have that notch.. It must be it, right? Would this explain this notch?
Please rate if my post was helpful!
Per favore e grazie!
Yeah this computer really isn't that out of date per-say. We just were forced to use XP because of driver issues with our laser printer. I keep noticing though I get a lot of odd behavior when on this system I am now(The XP one). For example, when drawing arcs. Not sure why but sometimes it will have this straight line that shoots out where the curve begins. Must be something with the system. Maybe the framework is out-of-date. I highly doubt my moms upgraded this computer at all.
Thanks for your help!
Please rate if my post was helpful!
Per favore e grazie!
Re: [RESOLVED] Random "notch" in my user-drawn control.
I actually found that my transparent key was 161,160,160. My guess isthat one pixel is that color. I use these for the aero glass effect and would explain why it's not drawing that one pixel.
Please rate if my post was helpful!
Per favore e grazie!
Re: [RESOLVED] Random "notch" in my user-drawn control.
Originally Posted by DavesChillaxin
I actually found that my transparent key was 161,160,160. My guess isthat one pixel is that color. I use these for the aero glass effect and would explain why it's not drawing that one pixel.