Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Splash form - two triangles that go from Green to Blue

Posted on 2006-07-23
5
Medium Priority
?
245 Views
Last Modified: 2010-07-27
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!
0
Comment
Question by:smstrks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 2000 total points
ID: 17166102
>> I need to have the background color for my splash form go from Green (0 to 255) to Blue (255 to 0)
If you want just that, I don't think you need to create Rectangles and color them, Also what do you mean "GO FROM"
do you want it turn gradually say in a few seconds from Green to Blue ?
If yes you need a Timer

On Form Load have this....

        Dim ColorTimer As New Timer
        ColorTimer.Interval = 100
        BackColor = Color.FromArgb(0, 255, 0)
        AddHandler ColorTimer.Tick, AddressOf ColorTimer_Tick
        ColorTimer.Start()

Then have this Event Handler....

       Private Sub ColorTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If BackColor.G <= 0 Then
            CType(sender, Timer).Stop()
            Exit Sub
        End If

Run and wait for a 10-15 secs to see the effect

        BackColor = Color.FromArgb(0, BackColor.G - 1, BackColor.B + 1)
    End Sub

0
 

Author Comment

by:smstrks
ID: 17400043
Sorry! My computer crashed and I could not remember the url for this website!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question