Fading Form colours?
-
Hi I am trying to increase the appeal of my forms by ading the colours across them, I have found a couple of code snippets online but when i try to implement it myself the keywords get underlined by the intellisense in vb. eg: oForm.AutoRedraw = True oForm.DrawStyle = vbInsideSolid oForm.DrawMode = vbCopyPen oForm.DrawWidth = 2 oForm.ScaleMode = vbPixels it will leave a message saying that Autodraw is not a member of system.windows.forms.form the same for the other lines. has something changed in vb.net or something? how could i implement fading the form colours? thanks in advance Mr Oizo
-
Hi I am trying to increase the appeal of my forms by ading the colours across them, I have found a couple of code snippets online but when i try to implement it myself the keywords get underlined by the intellisense in vb. eg: oForm.AutoRedraw = True oForm.DrawStyle = vbInsideSolid oForm.DrawMode = vbCopyPen oForm.DrawWidth = 2 oForm.ScaleMode = vbPixels it will leave a message saying that Autodraw is not a member of system.windows.forms.form the same for the other lines. has something changed in vb.net or something? how could i implement fading the form colours? thanks in advance Mr Oizo
That's VB6 code. Although the syntax in VB.NET is very similar, it's a completely new language. Here you see that most of the properties that you try to use simply doesn't exist any more: MSDN Library: Graphics for VB6 users[^]
--- single minded; short sighted; long gone;
-
That's VB6 code. Although the syntax in VB.NET is very similar, it's a completely new language. Here you see that most of the properties that you try to use simply doesn't exist any more: MSDN Library: Graphics for VB6 users[^]
--- single minded; short sighted; long gone;
-
That's VB6 code. Although the syntax in VB.NET is very similar, it's a completely new language. Here you see that most of the properties that you try to use simply doesn't exist any more: MSDN Library: Graphics for VB6 users[^]
--- single minded; short sighted; long gone;
-
I managed to sort out what i needed using the following code. Unfortunately if i use it on a button in the paint event it clears the text off the button and the button isn't raised off the form like normal.... Any ideas on how i can fix that?
Dim rec As Rectangle = New Rectangle(0, 0, Me.Width, Me.Height) 'create a new recatangle 'Create a new brush. Make is a Gradient style brush. Dim myBrush As Brush = New Drawing.Drawing2D.LinearGradientBrush(rec, Color.Silver, Color.SteelBlue, Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal) 'draw the gradient onto the form. e.Graphics.FillRectangle(myBrush, rec)
Mr Oizo -
I managed to sort out what i needed using the following code. Unfortunately if i use it on a button in the paint event it clears the text off the button and the button isn't raised off the form like normal.... Any ideas on how i can fix that?
Dim rec As Rectangle = New Rectangle(0, 0, Me.Width, Me.Height) 'create a new recatangle 'Create a new brush. Make is a Gradient style brush. Dim myBrush As Brush = New Drawing.Drawing2D.LinearGradientBrush(rec, Color.Silver, Color.SteelBlue, Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal) 'draw the gradient onto the form. e.Graphics.FillRectangle(myBrush, rec)
Mr OizoYour prior post said you were trying to do that to a form. No, if you override the paint event of a button, you're going to have to do all the painting yourself, including the text and all the button states - mouse over, pressed, etc. What you're doing is painting over the button and only painting the background. If you want pretty gradient/glass buttons, there are tons of articles here on Code Project that will show you how to do that.
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee
-
Your prior post said you were trying to do that to a form. No, if you override the paint event of a button, you're going to have to do all the painting yourself, including the text and all the button states - mouse over, pressed, etc. What you're doing is painting over the button and only painting the background. If you want pretty gradient/glass buttons, there are tons of articles here on Code Project that will show you how to do that.
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee