This documentation is archived and is not being maintained.

IRootDesigner Interface

Provides support for root-level designer view technologies.

Namespace: System.ComponentModel.Design
Assembly: System (in system.dll)

public interface class IRootDesigner : IDesigner, IDisposable
/** @attribute ComVisibleAttribute(true) */ 
public interface IRootDesigner extends IDesigner, IDisposable
public interface IRootDesigner extends IDesigner, IDisposable
Not applicable.

A root designer is the designer that is in the top position, or root, of the current design-time document object hierarchy. A root designer must implement the IRootDesigner interface. A root designer typically manages the background view in designer view mode, and usually displays the controls within the base container of the current design time project.

The following code example demonstrates a IRootDesigner implementation associated with a sample user control. This IRootDesigner implementation displays a control for the background view in designer view by overriding the GetView method. You need to add a reference to the System.Design assembly to compile the example.

To use this example, add the source code to a project and show the RootViewSampleComponent in designer view to display the custom root designer view.

No code example is currently available or this language may not be supported.
package SampleRootDesigner;

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.ComponentModel.Design.*;
import System.Diagnostics.*;
import System.Drawing.*;
import System.Windows.Forms.*;
import System.Windows.Forms.Design.*;
// This sample demonstrates how to provide the root designer view, or
// design mode background view, by overriding IRootDesigner.GetView().
// This sample component inherits from RootDesignedComponent which 
// uses the SampleRootDesigner.
public class RootViewSampleComponent extends RootDesignedComponent
    public RootViewSampleComponent()
    } //RootViewSampleComponent
} //RootViewSampleComponent

// The following attribute associates the SampleRootDesigner designer 
// with the SampleComponent component.
/** @ attribute Designer(SampleRootDesigner .class.ToType(),
    IRootDesigner .class.ToType())
public class RootDesignedComponent extends Component
    public RootDesignedComponent()
    } //RootDesignedComponent
} //RootDesignedComponent

public class SampleRootDesigner extends  ComponentDesigner 
    implements  IRootDesigner
    // Member field of custom type RootDesignerView, a control that 
    // will be shown in the Forms designer view. This member is 
    // cached to reduce processing needed to recreate the 
    // view control on each call to GetView().
    private RootDesignerView mView;

    // This method returns an instance of the view for this root
    // designer. The "view" is the user interface that is presented
    // in a document window for the user to manipulate. 
    public Object GetView(ViewTechnology technology)
        if (!(technology.Equals(ViewTechnology.WindowsForms))) {
            throw new ArgumentException(
                "Not a supported view technology", "technology");
        if (mView == null) {
            // Some type of displayable Form or control is required 
            // for a root designer that overrides GetView(). In this 
            // example, a Control of type RootDesignerView is used.
            // Any class that inherits from Control will work.
            mView = new RootDesignerView(this);
        return mView;
    } //GetView

    // IRootDesigner.SupportedTechnologies is a required override for an
    // IRootDesigner. WindowsForms is the view technology used by this designer.  
    /** @property 
    public ViewTechnology[] get_SupportedTechnologies()
        return new ViewTechnology[] { ViewTechnology.WindowsForms };
    } //get_SupportedTechnologies

    // RootDesignerView is a simple control that will be displayed 
    // in the designer window.
    private class RootDesignerView extends Control
        private SampleRootDesigner mDesigner;

        public RootDesignerView(SampleRootDesigner designer)
            mDesigner = designer;
            set_Font(new Font(get_Font().get_FontFamily().get_Name(), 24));
        } //RootDesignerView

        protected void OnPaint(PaintEventArgs pe)

            // Draws the name of the component in large letters.
                get_Font(), Brushes.get_Yellow(), 
        } //OnPaint
    } //RootDesignerView
} //SampleRootDesigner

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0