Export (0) Print
Expand All

IWebFormsBuilderUIService Interface

Provides methods to start specific user interfaces for building properties at design-time.

For a list of all members of this type, see IWebFormsBuilderUIService Members.

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

Example

[Visual Basic] 
' 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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.UI.Design

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Design (in System.Design.dll)

See Also

IWebFormsBuilderUIService Members | System.Web.UI.Design Namespace

Show:
© 2014 Microsoft