Sorry for the multipost, but no one was responding in the other thread.
If any solution is forthcoming, I will return to the original thread
and post it there as well.
I've created a usercontrol and I'm trying to emulate the look of a mac
effect (just for showing some options to my boss) by using 2 gradient
rectangles. I'm having a LOT of trouble doing this, however, because I
keep getting a 1 or 2 pixel line showing up. Can someone look this
over and tell me what I might be doing wrong?
Usercontrol: the only code I have in here that is non-standard is this
(VB.Net 2003):
Private Sub ucHeader_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles MyBase.Paint
Dim c1 As System.Drawing.Color
Dim iMid As Integer
iMid = Me.Height / 2
Dim mBrush As New System.Drawing.Drawing2D.LinearGradientBrush( _
New System.drawing.Rectangle(0, 0, Me.Width, iMid), _
c1.FromArgb(255, 187, 215, 241), _
c1.FromArgb(255, 151, 197, 240), 90, False)
e.Graphics.FillRectangle(mBrush, New System.Drawing.Rectangle( _
0, 0, Me.Width, iMid))
Dim mBrush2 As New System.Drawing.Drawing2D.LinearGradientBrush( _
New System.drawing.Rectangle(0, 0, Me.Width, iMid), _
c1.FromArgb(255, 122, 182, 238), _
c1.FromArgb(255, 198, 253, 255), 90, False)
e.Graphics.FillRectangle(mBrush2, 0, iMid, Me.Width, iMid)
End Sub
I then have a main form that I just dropped my user control onto -- I
made the height 267 to test this...
If you run the example, it will show a light light blue line in the
middle -- this should NOT be there. I have experimented with all sorts
of variations for iMid -- adding 2 to it sometimes, subtracting 2, etc.
I can't get this to work.
I guess my first question is, when creating a brush, the rectangle that
I define, should that be 1 based or 0 based? Should I make the brush
as wide as the usercontrol? If I want to draw the usercontrol in 2
segments, like I have done, should I make the brush 1/2 the size? I
thought so...but now I'm way confused.
For the 2nd rectangle (the bottom half of the usercontrol), when
creating the brush, should the brush's y param be the middle of the
usercontrol, or should it be 0 or 1? The rest of the questions
apply...
I did read the documentation about how the FillRectangle method draws
the INTERIOR of the rectangle, and I thought that might be my problem,
but still couldn't make it work when creating my rectangle a few pixels
larger in both dimensions...
Any advice at all is greatly appreciated.
Matt