Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

color picker webcontrol?

1 view
Skip to first unread message

Jérôme Poudou

unread,
Jun 27, 2002, 7:30:55 AM6/27/02
to
Hi,

I'm ooking for a simple color picker webcontrol, like the behavior
distributed by MS.

thanks.

Jerome.

Jon Gohr

unread,
Jun 27, 2002, 12:07:07 PM6/27/02
to
Jerome,

What kind of functionality are you looking for in the
control? Server side/client side?

Jon

>.
>

Richard Guthrie

unread,
Jul 1, 2002, 12:17:52 PM7/1/02
to
Jerome:

You can use the System.Web.UI.Design.ColorBuilder class to render the
functionality at design time you are looking for. If you have any
additional questions post again with them and I will try to answer them for
you.


Richard Guthrie
ASP.Net Developer Support
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

Nate Hopkins

unread,
Aug 5, 2002, 12:55:35 PM8/5/02
to
Does the ColorBuilder class provide the same dialog that the bgColor
property of a web form does?
If so, its what I'm after; however, I haven't been able to locate any code
examples that use the
ColorBuilder class.

Could you post some example code of using the ColorBuilder class to set a
public property? Thanks.


Nate Hopkins


Richard Guthrie

unread,
Aug 5, 2002, 8:21:56 PM8/5/02
to
Nate:

Here is a sample custom control that uses the WebColorConverter to display
the same color picking ability that the other web controls use.

========================
Start Control Code
========================

using System;
using System.Drawing;
using System.Drawing.Design;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace MyCustomControls
{
public class MyControl : WebControl
{
private System.Drawing.Color textColor;
[
TypeConverterAttribute(typeof(WebColorConverter))
]
public System.Drawing.Color TextColor
{
get
{
return textColor;
}

set
{
textColor = value;
}
}

protected override void Render(HtmlTextWriter output)
{
output.Write("<B>" + TextColor.ToString() + "</B>");
}
}
}

========================
End Control Code
========================

As you can see I simply use a typeconverter attribute of type
WebColorConverter to add this functionality. Hope this helps.

0 new messages