Windows Phone Developers

Tuesday, April 21, 2009

How to Disable Custom Colors in ColorDialog using C# (.NET)

How to restrict the user to pre-defined colors in C# ColorDialog

With .NET’s ColorDialog one can select the pre-defined as well as the custom colors. For some reason, if you want only the pre-defined colors to be selected. Set the AllowFullOpen to false.

private void btnSelectColor_Click(object sender, EventArgs e)

{

colorDialog1.AllowFullOpen = false;

colorDialog1.ShowDialog();

this.BackColor = colorDialog1.Color;

}


ColorDialog with custom colors
Restricted ColorDialog

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment