开发者

How do I use the web colour editor in my own property grid?

开发者 https://www.devze.com 2022-12-27 04:04 出处:网络
I have a custom configuration tool for an application that uses the .Net PropertyGrid control. The classes underneath have Color properties that are edited in the grid. If I don\'t decorate the attri

I have a custom configuration tool for an application that uses the .Net PropertyGrid control.

The classes underneath have Color properties that are edited in the grid. If I don't decorate the attribu开发者_如何学JAVAtes at all I get a drop down colour picker that lets me choose Windows system colours.

However this is for a web site, so I want hexadecimal colour codes. I can specify these with a type converter:

[TypeConverter(typeof(WebColorConverter))]
public Color Background { ...

This fixes the input from RGB to hex, but the drop down stays as a list of Windows system colours - like this:

How do I use the web colour editor in my own property grid?

In Visual Studio when dealing with web controls I get a modal pop up with a hexagonal colour selector instead.

How do I use the web colour editor in my own property grid?

I want to get the modal web colour editor rather than the windows forms variant.

However, I looked at System.Web.UI.WebControls colour properties and they just specify the TypeConverter - they don't specify a UITypeEditor.

Anyone know how to get the same editor as the web controls?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号