ColorBuilder Class
Provides an HTML color string builder at design time that allows a user to select a color.
Assembly: System.Design (in System.Design.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | BuildColor(IComponent^, Control^, String^) | Starts a color editor to build an HTML color property value. |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The BuildColor method starts a user interface for selecting a color value.
The ColorBuilder class is not intended for use outside of the design time environment. ColorBuilder requires the IWebFormsBuilderUIService, which is typically available within a Web Forms project at design time. If you want to build HTML color strings, you may want to implement a method that converts the RGB values of a Color object to an HTML-compatible RRGGBB format string. If you intend to use a control to select a color or configure a color, you can build a user interface for this, or you may want to use a PropertyGrid control which allows you to edit Color properties with the default ColorEditor providing a color selection interface.
// Create a parent control. System::Windows::Forms::Control^ c = gcnew System::Windows::Forms::Control; c->CreateControl(); // Launch the Color Builder using the specified control // parent and an initial HTML format (S"RRGGBB") color String*. System::Web::UI::Design::ColorBuilder::BuildColor( this->Component, c, "405599" );
// Example designer provides a designer verb menu command to launch the // BuildColor method of the ColorBuilder. public ref class ColorBuilderDesigner: public System::Web::UI::Design::UserControlDesigner { public: ColorBuilderDesigner(){} property System::ComponentModel::Design::DesignerVerbCollection^ Verbs { // Provides a designer verb menu command for invoking the BuildColor // method of the ColorBuilder. [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override { DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; dvc->Add( gcnew DesignerVerb( "Launch Color Builder UI",gcnew EventHandler( this, &ColorBuilderDesigner::launchColorBuilder ) ) ); return dvc; } } private: // This method handles the S"Launch Color Builder UI" menu command. // Invokes the BuildColor method of the System::Web::UI::Design.ColorBuilder. void launchColorBuilder( Object^ /*sender*/, EventArgs^ /*e*/ ) { // Create a parent control. System::Windows::Forms::Control^ c = gcnew System::Windows::Forms::Control; c->CreateControl(); // Launch the Color Builder using the specified control // parent and an initial HTML format (S"RRGGBB") color String*. System::Web::UI::Design::ColorBuilder::BuildColor( this->Component, c, "405599" ); } }; // Example Web control displays the value of its text property. // This control is associated with the ColorBuilderDesigner. [DesignerAttribute(ColorBuilderDesigner::typeid,IDesigner::typeid)] public ref class ColorBuilderControl: public System::Web::UI::WebControls::WebControl { private: String^ text; public: property String^ Text { [Bindable(true), Category("Appearance"), DefaultValue("")] String^ get() { return text; } void set( String^ value ) { text = value; } } protected: virtual void Render( HtmlTextWriter^ output ) override { output->Write( Text ); } };
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

