0

Hey guys.

I want to use this code:

Imports System.Drawing

Public Class frmBG

  Private Sub frmBG_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    Dim g As Graphics = e.Graphics
    Dim p1 As Point = Me.ClientRectangle.Location
    Dim p2 As Point = New Point(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)
    Using brsGradient As New System.Drawing.Drawing2D.LinearGradientBrush(p1, p2, Color.Red, Color.Blue)
      g.FillRectangle(brsGradient, e.ClipRectangle)
      g.DrawImage(My.Resources.demoImage, Me.ClientRectangle.Location)
    End Using

  End Sub

  Private Sub frmBG_ResizeEnd(sender As Object, e As System.EventArgs) Handles Me.ResizeEnd
    Me.Invalidate()
  End Sub
End Class

That I found on the net to create a Colour gradient.

The only problem is that I want a very specific colour and so would need to use Hex Colour Codes.

How would I be able to do it with this code.

Could someone adapt it for me.

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by Reverend Jim
0

You can generate a color from numeric values by

Color.FromArgb(255, 100, 100, 255)

where the parameters are transparancy, r, g, and b.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.