Anti-Rich
Well-known member
hi all,
i have a problem with a custom control i am creating... now i have a custom gradient background that paints when the button is used, the only problem is, it clears the text when it paints the rectangle!! i know why this happens, but i dont know the overrides method to use to set the text.
could someone please help me? i have posted my class, and what i have done so far.
cheers all
adam
i have a problem with a custom control i am creating... now i have a custom gradient background that paints when the button is used, the only problem is, it clears the text when it paints the rectangle!! i know why this happens, but i dont know the overrides method to use to set the text.
could someone please help me? i have posted my class, and what i have done so far.
cheers all
adam
VB.NET:
Namespace Custom
Public Class Button : Inherits System.Windows.Forms.Button
#Region " Overriding Subs "
Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim b As Brush = New Drawing2D.LinearGradientBrush(e.ClipRectangle, Color.LightBlue, Color.DarkBlue, Drawing2D.LinearGradientMode.Vertical)
e.Graphics.FillRectangle(b, e.ClipRectangle)
End Sub
Protected Overrides Sub OnPrint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPrint(e)
End Sub
#End Region
Public Sub New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
End Sub
End Class
End Namespace