Share via


BaseForm(IServiceProvider) Constructor

Definition

When overridden in a derived class, initializes a new instance of the BaseForm class.

protected:
 BaseForm(IServiceProvider ^ serviceProvider);
protected BaseForm (IServiceProvider serviceProvider);
new Microsoft.Web.Management.Client.Win32.BaseForm : IServiceProvider -> Microsoft.Web.Management.Client.Win32.BaseForm
Protected Sub New (serviceProvider As IServiceProvider)

Parameters

serviceProvider
IServiceProvider

A IServiceProvider interface that represents the service provider for the form.

Examples

The following example implements the BaseForm constructor.

class MyShellFrm : BaseForm, IFrameHost {
public MyShellFrm(IServiceProvider serviceProvider,
   ShellComponents shellComponents)
    : base(serviceProvider) {
    _uiService = new UI_Svc((IWin32Window)this, (IFrameHost)this);
    _downLoadSvc = new DownLoadSvc();
    _propEditSvc = new PropEditSvc();
    _shellComponents = shellComponents;

    SuspendLayout();
    try {
        if (_uiService.RightToLeftLayout) {
            RightToLeft = RightToLeft.Yes;
            RightToLeftLayout = true;
        }

        IServiceContainer serviceContainer = (IServiceContainer)
            GetService(typeof(IServiceContainer));
        Debug.Assert(serviceContainer != null);

        if (serviceContainer != null) {
            serviceContainer.AddService(
                typeof(IManagementUIService), _uiService);
            serviceContainer.AddService(
                typeof(IPropertyEditingService), _propEditSvc);
        }

        setWidthHeightBounds();

        Font = (Font)((IManagementUIService)_uiService).Styles["DialogFont"];
        Text = "My custom tool";
        Icon = getMyIcon();

        _managementFrame = new ManagementFrame(serviceProvider, this);
        _managementFrame.SuspendLayout();
        try {
            _managementFrame.Name = "_managementFrame";
            _managementFrame.Dock = DockStyle.Fill;
            Controls.Add(_managementFrame);
        } finally {
            _managementFrame.ResumeLayout(false);
        }
    } finally {
        ResumeLayout();
    }
}

Applies to