Share via


ColorBuilder Sınıf

Tanım

Tasarım zamanında kullanıcının renk seçmesine olanak tanıyan bir HTML renk dizesi oluşturucusu sağlar.

public ref class ColorBuilder sealed
public sealed class ColorBuilder
type ColorBuilder = class
Public NotInheritable Class ColorBuilder
Devralma
ColorBuilder

Örnekler

// 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" );
// Create a parent control.
System.Windows.Forms.Control c = new System.Windows.Forms.Control();            
c.CreateControl();            

// Launch the Color Builder using the specified control 
// parent and an initial HTML format ("RRGGBB") color string.
System.Web.UI.Design.ColorBuilder.BuildColor(this.Component, c, "405599");
' Create a parent control.
Dim c As New System.Windows.Forms.Control()
c.CreateControl()

' Launch the Color Builder using the specified control 
' parent and an initial HTML format ("RRGGBB") color string.
System.Web.UI.Design.ColorBuilder.BuildColor(Me.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 );
   }

};
// Example designer provides a designer verb menu command to launch the 
// BuildColor method of the ColorBuilder.
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")]
[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
public class ColorBuilderDesigner : System.Web.UI.Design.UserControlDesigner
{
    public ColorBuilderDesigner()
    {
    }

    // Provides a designer verb menu command for invoking the BuildColor 
    // method of the ColorBuilder.
    public override System.ComponentModel.Design.DesignerVerbCollection Verbs
    {
        get
        {
            DesignerVerbCollection dvc = new DesignerVerbCollection();                               
            dvc.Add( new DesignerVerb("Launch Color Builder UI", new EventHandler(this.launchColorBuilder)) ); 
            return dvc;
        }
    }

    // This method handles the "Launch Color Builder UI" menu command.
    // Invokes the BuildColor method of the System.Web.UI.Design.ColorBuilder.
    private void launchColorBuilder(object sender, EventArgs e)
    {
        // Create a parent control.
        System.Windows.Forms.Control c = new System.Windows.Forms.Control();            
        c.CreateControl();            
        
        // Launch the Color Builder using the specified control 
        // parent and an initial HTML format ("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(typeof(ColorBuilderDesigner), typeof(IDesigner))]
public class ColorBuilderControl : System.Web.UI.WebControls.WebControl
{
    private string text;

    [Bindable(true),
    Category("Appearance"),
    DefaultValue("")]
    public string Text
    {
        get
        {
            return text;
        }

        set
        {
            text = value;
        }
    }

    protected override void Render(HtmlTextWriter output)
    {
        output.Write(Text);
    }
}
' Example designer provides a designer verb menu command to launch the 
' BuildColor method of the ColorBuilder.
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name:="FullTrust" ), _
System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust" )> _
Public Class ColorBuilderDesigner
    Inherits System.Web.UI.Design.UserControlDesigner

    Public Sub New()
    End Sub

    ' Provides a designer verb menu command for invoking the BuildColor 
    ' method of the ColorBuilder.
    Public Overrides ReadOnly Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection
        Get
            Dim dvc As New DesignerVerbCollection()
            dvc.Add(New DesignerVerb("Launch Color Builder UI", New EventHandler(AddressOf Me.launchColorBuilder)))
            Return dvc
        End Get
    End Property

    ' This method handles the "Launch Color Builder UI" menu command.
    ' Invokes the BuildColor method of the System.Web.UI.Design.ColorBuilder.
    Private Sub launchColorBuilder(ByVal sender As Object, ByVal e As EventArgs)

        ' Create a parent control.
        Dim c As New System.Windows.Forms.Control()
        c.CreateControl()

        ' Launch the Color Builder using the specified control 
        ' parent and an initial HTML format ("RRGGBB") color string.
        System.Web.UI.Design.ColorBuilder.BuildColor(Me.Component, c, "405599")
      
    End Sub

End Class

' Example Web control displays the value of its text property.
' This control is associated with the ColorBuilderDesigner.
<DesignerAttribute(GetType(ColorBuilderDesigner), GetType(IDesigner))> _
Public Class ColorBuilderControl
    Inherits System.Web.UI.WebControls.WebControl
    Private [text_] As String

    <Bindable(True), Category("Appearance"), DefaultValue("")> _
    Public Property [Text]() As String
        Get
            Return [text_]
        End Get

        Set(ByVal Value As String)
            [text_] = Value
        End Set
    End Property

    Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
        output.Write([Text])
    End Sub

End Class

Açıklamalar

yöntemi, BuildColor renk değeri seçmek için bir kullanıcı arabirimi başlatır.

ColorBuilder sınıfı, tasarım zamanı ortamının dışında kullanım için tasarlanmamıştır. ColorBuilderIWebFormsBuilderUIServicegenellikle tasarım zamanında bir Web Forms projesinde kullanılabilen öğesini gerektirir. HTML renk dizeleri oluşturmak istiyorsanız, bir nesnenin RGB değerlerini Color HTML uyumlu bir RRGGBB biçim dizesine dönüştüren bir yöntem uygulamak isteyebilirsiniz. Renk seçmek veya renk yapılandırmak için bir denetim kullanmayı planlıyorsanız, bunun için bir kullanıcı arabirimi oluşturabilir veya bir renk seçimi arabirimi sağlayan varsayılan ColorEditor özellikleri düzenlemenize Color olanak tanıyan bir denetim kullanmak PropertyGrid isteyebilirsiniz.

Yöntemler

BuildColor(IComponent, Control, String)

HTML renk özelliği değeri oluşturmak için bir renk düzenleyicisi başlatır.

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır