Drawing a splash screen with two triangles having a gradient color scheme.


I need to draw a splash screen with two triangles having a gradient color scheme. The end result at the URL from this site is exactly what I need, except that I need to do it with a DrawLine method and Pen and Point objects and cannot determine how to do this.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21552863.html?qid=21552863
SkiprrrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PockyMasterCommented:
I don't see the point of using a point but you can do like this :

 Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        Dim g As Graphics = e.Graphics

        Dim myPen As New Pen(Color.Black)
        For i As Integer = 0 To 255
            myPen.Color = Color.FromArgb(255, i, 255)
            g.DrawLine(myPen, 0, i, 255 - i, i)
            myPen.Color = Color.FromArgb(255, 255, (255 - i))
            g.DrawLine(myPen, (255 - i), i, 255, i)
        Next

    End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PockyMasterCommented:
Using points as well you will get :

  Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        Dim g As Graphics = e.Graphics

        Dim myPen As New Pen(Color.Black)
        For i As Integer = 0 To 255
            myPen.Color = Color.FromArgb(255, i, 255)
            g.DrawLine(myPen, New Point(0, i), New Point(255 - i, i))
            myPen.Color = Color.FromArgb(255, 255, (255 - i))
            g.DrawLine(myPen, New Point(255 - i, i), New Point(255, i))

        Next

    End Sub

That should cover points, pen and drawline!
0
Bob LearnedCommented:
Nice job, but you missed the gradient part.

Bob
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

PockyMasterCommented:
It is gradient, isnt it?
I calculate the new color while moving the lines down
0
Bob LearnedCommented:
My interpretation of the gradient would have been fill with a LinearGradientBrush, but actually who knows?

Bob
0
PockyMasterCommented:
Well, but that one was too easy I guess, it's way easier to implement it with a linearGradientBrush ofcourse, but how to do that using Point, DrawLine and Pen?
Due to these specs, I guess old school drawline with a varying color is the way to go :D
0
Bob LearnedCommented:
No, I meant filling something like a GraphicsPath with points defining the triangle area using a LinearGradientBrush, not drawing lines with a gradient brush.

But, ultimately, since this seems to be a question with no feedback from anyone but us, it's pointless to guess.

Bob
0
PockyMasterCommented:
heheh, you're right, but what you just mentioned was the original solution he put the ref to in the first place (so that's what he didnt want :D)
0
Bob LearnedCommented:
That, my friend, is a very good point ;)  LOL =:)

Bob
0
SkiprrrAuthor Commented:
The solution I needed was per a spec for an online class that I am taking for vb.net (newbie here) and unfortunately the teacher has not been much help with enabling me to understand the graphics class.

skip
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.