Splash Screen: 2 Triangles with a graduated color scheme

  • 14 years ago

    Hi.

    I do not know how to create the code for two traingles with a graduated color scheme in a splash screen form. Hint: These triangles were created by drawing successibely shorter lines and varying the color for each line drawn. The top triangle varies the green value from 0 to 255. The red and blue values are zero. The lower-right triangle was created by varing the blue from 255 to 0. The red and green values are 0.

    I need the sample coding.

    Many thanks.

  • 14 years ago

    Everything to do 2d drawing is located under the system.drawing namespace.  You need a graphics object to do the drawing and an image to draw on.  The code I provided in your other thread uses these two elements to draw a triangle.  Here is another snippet that simplifies the whole thing.  All I did here was draw a line, which according to your hint is what you need to be able to do.  From the sounds of it I'm guessing you are doing some project for school so I really don't think I should do the whole thing for you, but once you can draw a line you should be able to figure out how to create a triangle using many lines.

            'Image thats 50x50
            Dim bmp As New Bitmap(50, 50)
            'Graphics object to do the drawing
            Dim gr As Graphics = Graphics.FromImage(bmp)
    
            'Draw a line from point (0,0) to (50,0) (ie. a horizontal line 50 pixels wide)
            gr.DrawLine(Pens.Black, 0, 0, 50, 0)
            'Clean up
            gr.Dispose()
            'Set the image drawn as PictureBox1's image
            PictureBox1.Image = bmp
  • 14 years ago

    Thanks.

     

    Yes it is for my school project. I will work on it. Will let you know.

     

    Thanks,

    Regena

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou