Blake81
Well-known member
Most of this user control works (that I've written about in other posts), but I'm still having a problem with two of the ellipses not resizing properly when I resize the control at design time. I've changed the values for width and height on everything to math expressions that should make them relative to the size of the control, but they still don't look right. The problem is when the height of the control exceeds some number (around 154, I think). The two ellipses that are giving me problems are Ellipse1 and Ellipse2. I'd appreciate any help with this one.
This is where everthing is declared.
I call this sub before the graphics object does its painting
This is where everthing is declared.
VB.NET:
Private stroke3 As System.Drawing.Pen = New System.Drawing.Pen(System.Drawing.Color.FromArgb(0, 255, 255, 255), 1.0!)
Private Ellipse3Brush As System.Drawing.SolidBrush = New System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 255, 255, 255))
Private Ellipse3Pen As System.Drawing.Pen = New System.Drawing.Pen(System.Drawing.Color.DimGray, 2.0!)
Protected Ellipse3 As System.Drawing.Rectangle = New System.Drawing.Rectangle(0, 1, Me.Width - 6, Me.Height)
Protected Ellipse1 As System.Drawing.Rectangle = New System.Drawing.Rectangle(3, 4, Me.Width * 0.98, Me.Height * 0.93)
Private Ellipse1Brush As System.Drawing.Drawing2D.LinearGradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New System.Drawing.Rectangle(0, 0, Me.Width * 0.98, Me.Height * 0.93), System.Drawing.Color.FromArgb(215, 255, 0, 0), System.Drawing.Color.FromArgb(255, 0, 0, 0), System.Drawing.Drawing2D.LinearGradientMode.Vertical)
Protected Text3 As String = "TESTING"
Private Text3Format As System.Drawing.StringFormat = New System.Drawing.StringFormat(System.Drawing.StringFormat.GenericTypographic)
Private Text3Font As System.Drawing.Font = New System.Drawing.Font("DS-Digital", 48.0!, CType(1, System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, 1)
Private Text3Rect As System.Drawing.RectangleF = New System.Drawing.RectangleF(0, Me.ClientSize.Height - 57, Me.ClientSize.Width + 3, Me.ClientSize.Height - 57)
Private Text3Brush As System.Drawing.Drawing2D.LinearGradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(Me.ClientRectangle, bcolor, System.Drawing.Color.FromArgb(110, 255, 255, 255), System.Drawing.Drawing2D.LinearGradientMode.Vertical)
Private Ellipse2Brush As System.Drawing.Drawing2D.LinearGradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New System.Drawing.Rectangle(42, 3, 212, 83), System.Drawing.Color.FromArgb(255, 255, 255, 255), System.Drawing.Color.FromArgb(0, 255, 255, 255), System.Drawing.Drawing2D.LinearGradientMode.Vertical)
Protected Ellipse2 As System.Drawing.Rectangle = New System.Drawing.Rectangle(42, 3, Me.Width * 0.55, Me.Height * 0.47)
Private Ellipse5Brush As System.Drawing.SolidBrush = New System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0, 255, 255, 255))
Private Ellipse5Pen As System.Drawing.Pen = New System.Drawing.Pen(System.Drawing.Color.Black, 2.0!)
Protected Ellipse5 As System.Drawing.Rectangle = New System.Drawing.Rectangle(1, 0, Me.Width - 6, Me.Height)
I call this sub before the graphics object does its painting
VB.NET:
Private Sub InitializeGraphics()
Ellipse1 = New System.Drawing.Rectangle(3, 4, Me.Width * 0.98, Me.Height * 0.93)
Me.Text3Format.Alignment = System.Drawing.StringAlignment.Center
Me.BackColor = Color.Transparent
Text3Rect = New System.Drawing.RectangleF(0, Me.ClientSize.Height / 2 - 24, Me.ClientSize.Width + 3, Me.ClientSize.Height - 57)
Ellipse3 = New System.Drawing.Rectangle(0, 1, Me.Width - 6, Me.Height)
Ellipse2 = New System.Drawing.Rectangle(42, 3, Me.Width - 85, Me.Height - 72)
Ellipse5 = New System.Drawing.Rectangle(1, 0, Me.Width - 6, Me.Height)
End Sub