• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

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
0
Skiprrr
Asked:
Skiprrr
  • 5
  • 4
1 Solution
 
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
 
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now