Add color palette to form

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2007
Posts: 192
Reputation: plusplus is an unknown quantity at this point 
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Add color palette to form

 
0
  #1
Aug 13th, 2007
I'd like to add a color palette to my form, so that the user can choose a color. How can I add such a palette to my form(with all the colors vb offers)?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is online now Online
Practically a Posting Shark

Re: Add color palette to form

 
0
  #2
Aug 13th, 2007
Hi,
Add this Control to ur ToolBox:
"Microsoft Commom Dialog Control 6.0" to ur Project. Place the Control on the Form and rename it as "cdlg"
and use this Code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Dim mycol
  3. cdlg.ShowColor
  4. mycol = cdlg.Color
  5. Me.BackColor = mycol
  6. End Sub

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 192
Reputation: plusplus is an unknown quantity at this point 
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: Add color palette to form

 
0
  #3
Aug 13th, 2007
Two questions
1. I'd like to also add the system colors
2. How to move the palette to a certain place on the screen?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is online now Online
Practically a Posting Shark

Re: Add color palette to form

 
0
  #4
Aug 15th, 2007
Hi,

U cannot Control the position of CommonDialog control. But there is an alternative, Place the common Dialog on a New Form, and Move the Form to Desired position on Screen and Show the Form.

Some thing like this : Add a Form And Rename it as frmColor:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim frmColor As New frmColor
  2. frmColor.Move 200,500
  3. frmColor.cdlg.ShowColor

Not very sure abt system colors...

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 192
Reputation: plusplus is an unknown quantity at this point 
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: Add color palette to form

 
0
  #5
Aug 15th, 2007
Thanks,works great
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 3220 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC