I need help creating 2 polygons on a Splash

blueeyes53

Active member
Joined
May 2, 2006
Messages
25
Programming Experience
Beginner
:confused: Hi there,
I need to create 2 polygons on a splash screen. How do I calculate the size that I want to make them.

Top triangle: varies the green value from 0 to 255. The red and blue values are zero.

Lower triangle: was created by varying the blue value from 255 to 0. The red and green values are 0.

How to calculate the size that you want the triangles to be?

Thank you
Blueeyes:confused:
 
NP... Glad to help myself as well as read others posts. They always help me better my own skills when I read somthing I overlooked or didn't think of.
 
r u willing to share i'm a beginner also

Blueeyes
I believe we have very similar task. I can't get the colors to blend
where it should be Green and Black fade.
R u willing to share that piece of code with me
 
misty1950, do you want something like what ImDaFreak has shown in post twelve? If so the code for that has already been posted on this thread. Or are you trying to do something different?
 
2 polygons on a Splash

I added that code and change the Replace where Red to Green and Blue to Black. Not the expected results. I am a Novice with VB but I have to get up to speed like yesterday. I will continue to work on it. Learning VB on my own . How do I have a Text line to fit in the upper left corner. I tried it but it is at the lower left corner.Thanks just the same.
 
Like this you mean?

VB.NET:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim a As New System.Drawing.Drawing2D.LinearGradientBrush(Me.ClientRectangle, Color.Red, Color.Blue, Drawing2D.LinearGradientMode.ForwardDiagonal)
'points for triangle 1
Dim T1(2) As Point
T1(0) = New Point(5, 5)
T1(1) = New Point(5, Me.ClientSize.Height - 5)
T1(2) = New Point(Me.ClientSize.Width - 5, 5)
'points for triangle 2
Dim T2(2) As Point
T2(0) = New Point(Me.ClientSize.Width - 5, Me.ClientSize.Height - 5)
T2(1) = New Point(Me.ClientSize.Width - 5, 5)
T2(2) = New Point(5, Me.ClientSize.Height - 5)
e.Graphics.DrawPolygon(Pens.Red, T1)
e.Graphics.DrawPolygon(Pens.Blue, T2)
e.Graphics.DrawString("This Is A String", Me.Font, SystemBrushes.WindowText, 10, 10)
a.Dispose()
End Sub
 
I wish I could help you, but I am still stuck myself...

Misty,
I am still working on it too. I am also a beginner what I have it is the 2 polygons posted on post #9. I haven't been able to place a text in the upper part of the top polygon, either have I not been able to do is to blend the colors as expected. I am still working on it. What I do is I just work on it for a while and if I am not able to accomplish this what I do is I go and work in something else , and then I go back and work a little on it. Because if I just stay I will be left behind in my learning.

As I have already mentioned above, I am also in the process of learning,but if there is any time that I can help with anything please do let me know.

You are right it seems as if we are trying to shade the same colors for the splash, by any chance are you using the book:
Visual Basic.NET: An Object - Oriented Approach
by Michael Ekedahl and William Newman (Comprehensive)

This particular is in Chapter 6 Exercise 2, if this is correct maybe we could help one another, because I am trying to learn it on my own , and I am having difficulties in certain areas.

Thanks
 
Yep You got it Same Book, Same problem. I was getting discourage but I will conquer this. I got an update, seems like your code with an addition. Look at this:
VB.NET:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  Dim a As New System.Drawing.Drawing2D.LinearGradientBrush( _
    Me.ClientRectangle, Color.Red, Color.Blue, Drawing2D.LinearGradientMode.ForwardDiagonal)
  'points for triangle 1
  Dim T1(2) As Point
  T1(0) = New Point(5, 5)
  T1(1) = New Point(5, Me.ClientSize.Height - 5)
  T1(2) = New Point(Me.ClientSize.Width - 5, 5)
  'points for triangle 2
  Dim T2(2) As Point
  T2(0) = New Point(Me.ClientSize.Width - 5, Me.ClientSize.Height - 5)
  T2(1) = New Point(Me.ClientSize.Width - 5, 5)
  T2(2) = New Point(5, Me.ClientSize.Height - 5)
  e.Graphics.DrawPolygon(Pens.Red, T1)
  e.Graphics.DrawPolygon(Pens.Blue, T2)
  'THIS PART IS NEW: I had it but in the wrong Place !!
  e.Graphics.DrawString("This Is A String", Me.Font, SystemBrushes.WindowText, 10, 10)
  a.Dispose()
End Sub
 
Last edited by a moderator:
Back
Top