Results 1 to 6 of 6

Thread: Draw Panel Gradient [Resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127

    Question Draw Panel Gradient [Resolved]

    Greetings all,

    I need code modification help for the code below. It's part of a gradient draw on a form but I want to use custom colors in HEX
    like below or the translated RGB format instead of the standard Green to Pale Green etc.. format. Any examples how it could be done?

    Code:
    Private Sub DrawGradient(ByVal color1 As Color, ByVal color2 As Color, ByVal mode As System.Drawing.Drawing2D.LinearGradientMode)
            Dim a As New System.Drawing.Drawing2D.LinearGradientBrush(New RectangleF(0, 0, Me.Width, Me.Height), color1, color2, mode)
            Dim g As Graphics = Me.CreateGraphics
            g.FillRectangle(a, New RectangleF(0, 0, Me.Width, Me.Height))
            g.Dispose()
        End Sub
    
    Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
            DrawGradient(Color.#33CC33, Color.#009900, Drawing.Drawing2D.LinearGradientMode.Vertical)
        End Sub
    Last edited by teamdad; Aug 3rd, 2004 at 01:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width