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.

You can generate a color from numeric values by

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.