ColorDialog CodeSample - Selecting color

From Visual WebGui Wiki

Jump to: navigation, search


Overview

An example on how you use the ColorDialog to pick a color. Note that the control is a DialogForm so the usage is similar to other such Forms in that you register a handler for the Closed event.

VB.NET Code

Imports Gizmox.WebGui.Forms
Public Class Form1
 
    Friend WithEvents ColorDialog1 As Gizmox.WebGui.Forms.ColorDialog
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ColorDialog1 = New Gizmox.WebGui.Forms.ColorDialog
        ColorDialog1.ShowDialog()
    End Sub
 
    Private Sub ColorDialog1_Closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorDialog1.Closed
        If ColorDialog1.DialogResult = Gizmox.WebGui.Forms.DialogResult.OK Then
            MessageBox.Show("You selected " + ColorDialog1.Color.ToString())
        End If
    End Sub
End Class

C# Code

Personal tools