smstrks
asked on
Splash form - two triangles that go from Green to Blue
I need to have the background color for my splash form go from Green (0 to 255) to Blue (255 to 0). I found the code in a previous post but it doesn't work. It still displays what was produced when I tried to make the splash form. The code I used is this:
Private Sub frmSplash_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.Paint EventArgs) Handles MyBase.Paint
Dim rect As Rectangle = New Rectangle(20, 20, 200, 100)
Dim path As GraphicsPath
Dim region As Region
Dim brush As LinearGradientBrush
path = New GraphicsPath(FillMode.Alte rnate)
path.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top)
path.AddLine(rect.Left, rect.Top, rect.Right, rect.Top)
path.AddLine(rect.Right, rect.Top, rect.Left, rect.Bottom)
region = New Region(path)
brush = New LinearGradientBrush(rect, Color.Black, Color.Green, LinearGradientMode.Horizon tal)
e.Graphics.Clip = region
e.Graphics.FillRectangle(b rush, rect)
path = New GraphicsPath(FillMode.Alte rnate)
path.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom)
path.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom)
path.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Top)
region = New Region(path)
brush = New LinearGradientBrush(rect, Color.Blue, Color.Black, LinearGradientMode.Horizon tal)
e.Graphics.Clip = region
e.Graphics.FillRectangle(b rush, rect)
brush = New LinearGradientBrush(rect, Color.Blue, Color.Black, LinearGradientMode.Horizon tal)
brush.GammaCorrection = True ' add this line
End Sub
What this produces are rectangles, two green then one blue. The rectangles then have diamond shapes inside of them. Any help would be greatly appreciated!
Private Sub frmSplash_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.Paint
Dim rect As Rectangle = New Rectangle(20, 20, 200, 100)
Dim path As GraphicsPath
Dim region As Region
Dim brush As LinearGradientBrush
path = New GraphicsPath(FillMode.Alte
path.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top)
path.AddLine(rect.Left, rect.Top, rect.Right, rect.Top)
path.AddLine(rect.Right, rect.Top, rect.Left, rect.Bottom)
region = New Region(path)
brush = New LinearGradientBrush(rect, Color.Black, Color.Green, LinearGradientMode.Horizon
e.Graphics.Clip = region
e.Graphics.FillRectangle(b
path = New GraphicsPath(FillMode.Alte
path.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom)
path.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom)
path.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Top)
region = New Region(path)
brush = New LinearGradientBrush(rect, Color.Blue, Color.Black, LinearGradientMode.Horizon
e.Graphics.Clip = region
e.Graphics.FillRectangle(b
brush = New LinearGradientBrush(rect, Color.Blue, Color.Black, LinearGradientMode.Horizon
brush.GammaCorrection = True ' add this line
End Sub
What this produces are rectangles, two green then one blue. The rectangles then have diamond shapes inside of them. Any help would be greatly appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER