+92 332 4229 857 99ProjectIdeas@Gmail.com

Color Dialog (Vb.net)


Color Dialog
Color Dialog box represents a dialog box that display all the available colors.

Code

1.     Sub openColorDialog()
2.     Dim cd As New ColorDialog
3.     Dim clr As Color
4.     With cd
5.     .AnyColor = False
6.     .Color = Color.Blue
7.     .ShowHelp = True
8.     If .ShowDialog = Windows.Forms.DialogResult.OK Then
9.     clr = .Color
10.  txt_Alpha.Text = clr.A
11.  txt_Blue.Text = clr.B
12.  txt_Green.Text = clr.G
13.  txt_Red.Text = clr.R
14.  txt_Brightness.Text = clr.GetBrightness()
15.  txt_Hue.Text = clr.GetHue()
16.  txt_Saturation.Text = clr.GetSaturation()
17.  txt_ColorName.Text = clr.Name
18.  txt_ColorPreview.BackColor = clr
19.  End If
20.  End With
21.  End Sub

0 comments: