|
-
Feb 25th, 2008, 07:10 AM
#1
Thread Starter
Member
[RESOLVED] How to create a colorpicker like the one in wordpad??
Hi people,
Does one of you know how to create a "simple" colorpicker like the
one in Wordpad? The things i found on the internet are way too big and complicated. That would be overkill. The one like in wordpad would be perfect. I have a Rich TextBox on my form, it would be nice if a user could change the color of the "selected" text.
Hope someone can help..
Thanks,
Warad
-
Feb 25th, 2008, 07:11 AM
#2
Re: How to create a colorpicker like the one in wordpad??
-
Feb 25th, 2008, 07:28 AM
#3
Member
Re: How to create a colorpicker like the one in wordpad??
This is how I am doing it currently in an app...
Firstly, create a command button to call the colour picker....then add a common dialog control to the form.
Then, use this code!
Private Sub Command1_Click()
' This sub allows the user to select a colour
' Common Dialog Parameters
CommonDialog1.CancelError = True
On Error Resume Next
CommonDialog1.ShowColor
If Err.Number = cdlCancel Then
MsgBox "you pressed cancel!"
Exit Sub
End If
On Error GoTo 0
' Save the colour picked via the CommonDialog to a variable...
strColourPicked = CommonDialog1.Color
' Note: this isnt really needed - just showing you the colour picked ... do as you wish with it (probably programmatically adding the colour to the text1 foreground colour or such like?
msgbox = "Colour picked was: " & strColourPicked
End Sub
Hope that helps....working from memory and I am no expert!
Good luck.
-
Feb 25th, 2008, 08:14 AM
#4
Thread Starter
Member
Re: How to create a colorpicker like the one in wordpad??
Thanks vbsixer,
I just figurred out how to do this with "Selcolor".
But now i know what the common dialog control is for 
Warad
-
Feb 25th, 2008, 08:25 AM
#5
Re: How to create a colorpicker like the one in wordpad??
 Originally Posted by Warad
But now i know what the common dialog control is for 
The common dialog control has a number of uses. Color is just one of them.
-
Feb 25th, 2008, 01:51 PM
#6
Member
Re: How to create a colorpicker like the one in wordpad??
 Originally Posted by Warad
Thanks vbsixer,
I just figurred out how to do this with "Selcolor".
But now i know what the common dialog control is for
Warad
No bother Warad
as Hack says .. the common dialog does so much its scary! Its also used for your opening / saving files, in fact, anything that requires any kind of picking/accessing in a common look and feel i.e. as per most windows app which all look like the common dialog!
Used throughout my app, its also handy for your font picking and other such tasks....plus, users are "used" to it ... ideal!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|