[vb.net] Gradient Fill
-
well i'm trying to create a control that inherits from textbox or richtextbox to make the background gradient i use the following code : CODE Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) Dim gbr As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Me.Width, Me.Height), Color.White, Color.Blue, LinearGradientMode.Horizontal) e.Graphics.FillRectangle(gbr, New Rectangle(0, 0, Me.Width, Me.Height)) End Sub but this isn't working... the backcolor in both is always white. can someone help? thanks in advance ;)
-
well i'm trying to create a control that inherits from textbox or richtextbox to make the background gradient i use the following code : CODE Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) Dim gbr As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Me.Width, Me.Height), Color.White, Color.Blue, LinearGradientMode.Horizontal) e.Graphics.FillRectangle(gbr, New Rectangle(0, 0, Me.Width, Me.Height)) End Sub but this isn't working... the backcolor in both is always white. can someone help? thanks in advance ;)
You need to override OnPaintBackground. Yes, even I am blogging now!