Skip Navigation Links.
Using the Common Dialog control - ShowColor
Language(s):Visual Basic 6.0
Category(s):Common Dialog

Choosing colors with the CommonDialog control.

' Using the Common Dialog control - ShowColor

' Choosing colors with the CommonDialog control
'
' 1) Create a new project. Form1 will be created by default.
' 2) Select Project|Components from the menu and add the Microsoft Common Dialog Control to the project.
' 3) Add a Common Dialog Control to the form. 
' 4) Add a Command Button to the form. 
' 5) Paste the following code into the declarations section of Form1:

' --- Begin code for Form1

Option Explicit

Private Sub Form_Load()
  
  Me.Caption = "CommonDialog Example - ShowColor"
  Command1.Caption = "&ShowColor"
  
End Sub

Private Sub Command1_Click()

  CommonDialog1.ShowColor
  Me.BackColor = CommonDialog1.Color
  
End Sub

' --- End code for Form1 ---

This article has been viewed 2078 times.
The examples on this page are presented "as is". They may be used in code as long as credit is given to the original author. Contents of this page may not be reproduced or published in any other manner what so ever without written permission from Idioma Software Inc.