Color chooser dialog : Dialog Color Chooser « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Dialog Color ChooserScreenshots 
Color chooser dialog
Color chooser dialog

Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources


Public Class OptionsDialog
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents okButton As System.Windows.Forms.Button
    Friend WithEvents changeColorButton As System.Windows.Forms.Button
    Friend WithEvents label1 As System.Windows.Forms.Label
    Friend WithEvents errorProvider1 As System.Windows.Forms.ErrorProvider
    Friend WithEvents colorDialog1 As System.Windows.Forms.ColorDialog
    Friend WithEvents _cancelButton As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.okButton = New System.Windows.Forms.Button()
        Me.changeColorButton = New System.Windows.Forms.Button()
        Me._cancelButton = New System.Windows.Forms.Button()
        Me.label1 = New System.Windows.Forms.Label()
        Me.errorProvider1 = New System.Windows.Forms.ErrorProvider()
        Me.colorDialog1 = New System.Windows.Forms.ColorDialog()
        Me.SuspendLayout()
        '
        'okButton
        '
        Me.okButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right)
        Me.okButton.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.okButton.Location = New System.Drawing.Point(3264)
        Me.okButton.Name = "okButton"
        Me.okButton.TabIndex = 5
        Me.okButton.Text = "OK"
        '
        'changeColorButton
        '
        Me.changeColorButton.Location = New System.Drawing.Point(1208)
        Me.changeColorButton.Name = "changeColorButton"
        Me.changeColorButton.TabIndex = 4
        Me.changeColorButton.Text = "Change..."
        '
        '_cancelButton
        '
        Me._cancelButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right)
        Me._cancelButton.CausesValidation = False
        Me._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me._cancelButton.Location = New System.Drawing.Point(12064)
        Me._cancelButton.Name = "_cancelButton"
        Me._cancelButton.TabIndex = 6
        Me._cancelButton.Text = "Cancel"
        '
        'label1
        '
        Me.label1.Location = New System.Drawing.Point(88)
        Me.label1.Name = "label1"
        Me.label1.TabIndex = 3
        Me.label1.Text = "Favorite Color"
        Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'errorProvider1
        '
        Me.errorProvider1.DataMember = Nothing
        '
        'OptionsDialog
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(208102)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me._cancelButton, Me.label1, Me.okButton, Me.changeColorButton})
        Me.Name = "OptionsDialog"
        Me.Text = "OptionsDialog"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub changeColorButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles changeColorButton.Click
        If colorDialog1.ShowDialog() = DialogResult.OK Then
            changeColorButton.BackColor = colorDialog1.Color
        End If
    End Sub

    Public Property FavoriteColor() As Color
        Get
            Return colorDialog1.Color
        End Get
        Set(ByVal Value As Color)
            changeColorButton.BackColor = Value
            colorDialog1.Color = Value
        End Set
    End Property

    Private Sub cancelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles _cancelButton.Click

    End Sub

    Shared Sub Main()
        Dim myform As Form = New OptionsDialog()
        Application.Run(myform)
    End Sub

End Class

           
       
Related examples in the same category
1.Customized Color DialogCustomized Color Dialog
2.Color dialog in VBColor dialog in VB
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.