|
Public Class Form1
Dim col As Color
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ColorPalette1.PaletteHeight = 100
ColorPalette1.PaletteWidth = 360
AddHandler ColorPalette1.ColorPaletteMouseMove, AddressOf ColorPalette1_MouseMove
AddHandler ColorPalette1.ColorPaletteSelect, AddressOf ColorPalette1_MouseLeftClick
col = Panel1.BackColor
End Sub
Private Sub ColorPalette1_MouseLeftClick(ByVal sender As System.Object, ByVal c As System.Windows.Media.Color)
Panel1.BackColor = System.Drawing.Color.FromArgb(255, Convert.ToInt32(c.R.ToString()), Convert.ToInt32(c.G.ToString()), Convert.ToInt32(c.B.ToString()))
End Sub
Private Sub ColorPalette1_MouseMove(ByVal sender As System.Object, ByVal c As System.Windows.Media.Color)
If (c = Nothing) Then
Panel1.BackColor = col
SetValues(col.R, col.G, col.B)
Else
Panel1.BackColor = System.Drawing.Color.FromArgb(255, Convert.ToInt32(c.R.ToString()), Convert.ToInt32(c.G.ToString()), Convert.ToInt32(c.B.ToString()))
SetValues(c.R, c.G, c.B)
End If
End Sub
Private Sub SetValues(ByVal r As String, ByVal g As String, ByVal b As String)
txtRed.Text = r
txtGreen.Text = g
txtBlue.Text = b
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.