VB.Net - Color Dialog Box
There are several classes that implement common dialog boxes, such as color selection and print setup etc.
The user can choose a color from either a set of basic or custom color palettes. You can invite a color dialog box by calling ShowDialog() method.
Dim dlg As New ColorDialog dlg.ShowDialog() |
The Color dialog box has a full version and a partial version of the user interface. The full version includes the basic controls and has additional controls that allow the user to create custom colors. The partial version has controls that display the basic and custom color palettes from which the user can select a color value. The system stores internal colors as 32-bit RGB values that have the following hexadecimal form: 0x00bbggrr.
The following Vb.Net program invites a color dialog box and retrieve the selected color to a string.
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim dlg As New ColorDialog dlg.ShowDialog() If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then Dim str As String str = dlg.Color.Name MsgBox(str) End If End Sub End Class