次の方法で共有


IWebFormsBuilderUIService インターフェイス

デザイン時にプロパティを構築するための特定のユーザー インターフェイスを起動するメソッドを提供します。

この型のすべてのメンバの一覧については、IWebFormsBuilderUIService メンバ を参照してください。

Public Interface IWebFormsBuilderUIService
[C#]
public interface IWebFormsBuilderUIService
[C++]
public __gc __interface IWebFormsBuilderUIService
[JScript]
public interface IWebFormsBuilderUIService

使用例

 
' Example designer provides designer verb menu commands to call the 
' BuildColor and BuildURL methods of the IWebFormsBuilderUIService.
Public Class WebFormsBuilderUIServiceDesigner
    Inherits System.Web.UI.Design.UserControlDesigner

    Public Sub New()
    End Sub

    ' Provides designer verb menu commands for invoking 
    ' IWebFormsBuilderUIService methods.
    Public Overrides ReadOnly Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection
        Get
            Dim dvc As New DesignerVerbCollection()
            dvc.Add( New DesignerVerb( _
                "Launch Color Builder UI using WebFormsBuilderUIService", _
                New EventHandler(AddressOf Me.launchColorBuilder)))
            dvc.Add( New DesignerVerb( _
                "Launch URL Builder UI using WebFormsBuilderUIService", _
                New EventHandler(AddressOf Me.launchUrlBuilder)))
            Return dvc
        End Get
    End Property

    Private Sub launchColorBuilder(ByVal sender As Object, ByVal e As EventArgs)
        ' Obtain an instance of an IWebFormsBuilderUIService.
        Dim builderService As IWebFormsBuilderUIService = _
            CType(Me.Component.Site.GetService(GetType(IWebFormsBuilderUIService)), _
            IWebFormsBuilderUIService)

        ' Return from method if the service was not obtained.            
        If builderService Is Nothing Then
            Return
        End If
        ' Create a parent control.
        Dim c As New System.Windows.Forms.Control()
        c.CreateControl()

        ' Start the color builder using the specified control 
        ' parent and an initial HTML format ("RRGGBB") color string.
        builderService.BuildColor(c, "405599")
    End Sub

    Private Sub launchUrlBuilder(ByVal sender As Object, ByVal e As EventArgs)
        ' Obtain an instance of an IWebFormsBuilderUIService.
        Dim builderService As IWebFormsBuilderUIService = _
        CType(Me.Component.Site.GetService(GetType(IWebFormsBuilderUIService)), _
            IWebFormsBuilderUIService)

        ' Return from method if the service was not obtained.            
        If builderService Is Nothing Then
            Return
        End If

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

        ' Start the URL builder using the specified control
        ' parent, initial URL, empty relative base URL path,
        ' window caption, empty filter string and URLBuilderOptions value.
        builderService.BuildUrl(c, "http://www.example.com", "", _
            "Select a URL", "", UrlBuilderOptions.None)
    End Sub

End Class

' Example Web control displays the value of its text property.
' This control is associated with the WebFormsBuilderUIServiceDesigner.
<DesignerAttribute(GetType(WebFormsBuilderUIServiceDesigner), _
    GetType(IDesigner))> _
Public Class WebCustomControl1
    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

[C#] 
// Example designer provides designer verb menu commands to call the 
// BuildColor and BuildURL methods of the IWebFormsBuilderUIService.
public class WebFormsBuilderUIServiceDesigner : System.Web.UI.Design.UserControlDesigner
{
        public WebFormsBuilderUIServiceDesigner()
        {            
        }

// Provides designer verb menu commands for invoking 
// IWebFormsBuilderUIService methods.
public override 
    System.ComponentModel.Design.DesignerVerbCollection Verbs
{
    get
    {
        DesignerVerbCollection dvc = new DesignerVerbCollection();
        dvc.Add( new DesignerVerb(
            "Launch Color Builder UI using WebFormsBuilderUIService", 
            new EventHandler(this.launchColorBuilder)) );                 
        dvc.Add( new DesignerVerb(
            "Launch URL Builder UI using WebFormsBuilderUIService", 
            new EventHandler(this.launchUrlBuilder)) );
        return dvc;
    }
}

private void launchColorBuilder(object sender, EventArgs e)
{
    // Obtain an instance of an IWebFormsBuilderUIService.
    IWebFormsBuilderUIService builderService =                 (IWebFormsBuilderUIService)this.Component.Site.GetService(
        typeof(IWebFormsBuilderUIService));

    // Return from method if the service was not obtained.            
    if( builderService == null )
        return;

    // Create a parent control.
    System.Windows.Forms.Control c = new System.Windows.Forms.Control();            
    c.CreateControl();            
    
    // Start the color builder using the specified control 
    // parent and an initial HTML format ("RRGGBB") color string.
    builderService.BuildColor(c, "405599");            
}        

private void launchUrlBuilder(object sender, EventArgs e)
{
    // Obtain an instance of an IWebFormsBuilderUIService.
    IWebFormsBuilderUIService builderService =                  (IWebFormsBuilderUIService)this.Component.Site.GetService(
         typeof(IWebFormsBuilderUIService));

    // Return from method if service was not obtained.            
    if( builderService == null )
        return;
    
    // Create a parent control.
    System.Windows.Forms.Control c = new System.Windows.Forms.Control();            
    c.CreateControl();            
    
    // Start the URL builder using the specified control
    // parent, initial URL, empty relative base URL path,
    // window caption, empty filter string and URLBuilderOptions value.
    builderService.BuildUrl(c, "http://www.example.com", "", 
        "Select a URL", "", UrlBuilderOptions.None);
}      
    }

    // Example Web control displays the value of its text property.
    // This control is associated with the WebFormsBuilderUIServiceDesigner.
    [DesignerAttribute(typeof(WebFormsBuilderUIServiceDesigner), 
typeof(IDesigner))]
    public class WebCustomControl1 : 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);
}
    }

[C++] 
// Example designer provides designer verb menu commands to call the
// BuildColor and BuildURL methods of the IWebFormsBuilderUIService.
public __gc class WebFormsBuilderUIServiceDesigner : 
   public UserControlDesigner {
public:
   WebFormsBuilderUIServiceDesigner() {
   }

   // Provides designer verb menu commands for invoking
   // IWebFormsBuilderUIService methods.
   __property DesignerVerbCollection* get_Verbs() {
      DesignerVerbCollection* dvc = new DesignerVerbCollection();
      dvc->Add(new DesignerVerb(S"Launch Color Builder UI using WebFormsBuilderUIService",
         new EventHandler(this, &WebFormsBuilderUIServiceDesigner::launchColorBuilder)));
      dvc->Add(new DesignerVerb(S"Launch URL Builder UI using WebFormsBuilderUIService",
         new EventHandler(this, &WebFormsBuilderUIServiceDesigner::launchUrlBuilder)));
      return dvc;
   }

private:
   void launchColorBuilder(Object* /*sender*/, EventArgs* /*e*/) {
      // Obtain an instance of an IWebFormsBuilderUIService.
      IWebFormsBuilderUIService* builderService =
         dynamic_cast<IWebFormsBuilderUIService*>(this->Component->Site->GetService(__typeof(IWebFormsBuilderUIService)));

      // Return from method if the service was not obtained.
      if (builderService == 0)
         return;

      // Create a parent control.
      System::Windows::Forms::Control* c = new System::Windows::Forms::Control();
      c->CreateControl();

      // Start the color builder using the specified control
      // parent and an initial HTML format (S"RRGGBB") color string.
      builderService->BuildColor(c, S"405599");
   }

   void launchUrlBuilder(Object* /*sender*/, EventArgs* /*e*/) {
      // Obtain an instance of an IWebFormsBuilderUIService.
      IWebFormsBuilderUIService* builderService =
         dynamic_cast<IWebFormsBuilderUIService*>(this->Component->Site->GetService(__typeof(IWebFormsBuilderUIService)));

      // Return from method if service was not obtained.
      if (builderService == 0)
         return;

      // Create a parent control.
      System::Windows::Forms::Control* c = new System::Windows::Forms::Control();
      c->CreateControl();

      // Start the URL builder using the specified control
      // parent, initial URL, empty relative base URL path,
      // window caption, empty filter string and URLBuilderOptions value.
      builderService->BuildUrl(c, S"http://www.example.com", S"",
         S"Select a URL", S"", UrlBuilderOptions::None);
   }
};

// Example Web control displays the value of its text property.
// This control is associated with the WebFormsBuilderUIServiceDesigner.
[DesignerAttribute(__typeof(WebFormsBuilderUIServiceDesigner),
                   __typeof(IDesigner))]
public __gc class WebCustomControl1 : public WebControl {
private:
   String*  text;

public:
   [Bindable(true),
      Category(S"Appearance"),
      DefaultValue(S"")]
   __property String* get_Text() {
      return text;
   }
   __property void set_Text(String* value) {
      text = value;
   }

protected:
   void Render(HtmlTextWriter* output) {
      output->Write(Text);
   }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Web.UI.Design

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Design (System.Design.dll 内)

参照

IWebFormsBuilderUIService メンバ | System.Web.UI.Design 名前空間