Link to home
Start Free TrialLog in
Avatar of smstrks
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.PaintEventArgs) 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.Alternate)
        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.Horizontal)

        e.Graphics.Clip = region
        e.Graphics.FillRectangle(brush, rect)


        path = New GraphicsPath(FillMode.Alternate)
        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.Horizontal)

        e.Graphics.Clip = region
        e.Graphics.FillRectangle(brush, rect)

        brush = New LinearGradientBrush(rect, Color.Blue, Color.Black, LinearGradientMode.Horizontal)
        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
Avatar of arif_eqbal
arif_eqbal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smstrks
smstrks

ASKER

Sorry! My computer crashed and I could not remember the url for this website!