Color Dialog

G

Greg

I've been trying to figure out how to show a color dialog in VB.Net . I've
come across the following code that shows it, but its not the advanced color
dialog I am looking for. I know there is another way to show a color dialog
box, but I can't seem to find it.

Dim MyDialog As New ColorDialog()
' Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = False
' Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = True
' Sets the initial color select to the current text color,
MyDialog.Color = Me.BackColor
' Update the text box color if the user clicks OK
If (MyDialog.ShowDialog() = DialogResult.OK) Then
Me.BackColor = MyDialog.Color
End If

I thought there was a shortcut type of code that would allow me to show the
color dialog. Can anyone point me in the right direction .

Thanks.
 
L

Linda Liu[MSFT]

Hi,

In WinForm applications, there's only one way to show a color dialog, i.e.
create an instance of ColorDialog class and call the Show or ShowDialog
method of the dialog instance to show it.
I've come across the following code that shows it, but its not the
advanced color dialog I am looking for.

What is the advanced color dialog you are looking for?
I thought there was a shortcut type of code that would allow me to show
the color dialog.

No, there isn't a shortcut type of code that would allow us to show the
color dialog.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

Kerem Gümrükcü

Hi Greg,

have a look at this Assembly i wrote. It uses native Windows API ChoseColor
function to show the Color Choosing Dialog and comes with a powerfull class
that gives you access to a (Common) Dialog or any windows that you hook with
it. You can enumerate its childs, extend the dialog with your own controls,
resize
it, modify it in any way you want. The classes have events (callbacks) that
will
inform you of such events e.g. when you successfully hooked a window.
Anything
that has a Window handle can be hooked, anything! The ChooseColor Dialog
has some properties where you can set all controls text on the ChooseColor
Dialog which makes it comletely language indipendend, what the main purpose
of this class was at first.

http://entwicklung.junetz.de/projects/opensource/CommonDialogsLibrary/CommonDialogsLibrary.dll

You can have source if you like,....(C# 2008 project) but target is .NET
2.0+

Browse the assemblies internals to see what it can do for you. Sorry i have
no documentation
yet, but for future it will have one.

See this classes:
ChooseColorDialog
CommonDialogClassHelper
WindowsAPIClass

Hope this helps,...


Regards

Kerem

--
 
G

Greg

When the dialog opens, there is a button to expand the color dialog for the
user to create their own color definition. But, when I show the dialog this
button is not enabled. Do I have to enable it somehow?
 
K

Kerem Gümrükcü

Hi Greg,

have a look at the ColorDialog members:
ColorDialog.FullOpen = true;

possibly this too:
ColorDialog.AllowFullOpen = true;

is what you are looking for,...

Maybe this for future:
ColorDialog.AnyColor = true;

As said, have a look at all the ColorDialog Properties,...


Regards

Kerem

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top