IDesignerHost.GetDesigner() is a method provided by the .NET Framework that returns the designer for the specified component. It takes a Type parameter that specifies the type of designer to retrieve and a component parameter that specifies the component to retrieve the designer for.
Code Example 1:
// Get the root component IComponent rootComponent = _designerHost.RootComponent;
// Get the designer for the root component var designer = _designerHost.GetDesigner(rootComponent);
// Do something with the designer if (designer != null) { designer.DoAction(); }
Example 1 Brief Description:
In this example, we are retrieving the designer for the root component in the designer host. We first retrieve the root component using the RootComponent property, then we pass it to the GetDesigner() method to get the designer for that component. If a designer is returned, we perform some action using the designer.
Code Example 2:
// Get a reference to a component MyComponent myComponent = _designerHost.Container.Components["MyComponent"] as MyComponent;
// Get the designer for the component var designer = _designerHost.GetDesigner(myComponent, typeof(MyComponentDesigner));
// Do something with the designer if (designer != null) { designer.DoAction(); }
Example 2 Brief Description:
In this example, we are retrieving the designer for a specific component, MyComponent. We first obtain a reference to the component using the Components collection of the designer host. We then pass this component and the type of designer we want to retrieve (MyComponentDesigner) to the GetDesigner() method. If a designer of that type is returned, we perform some action using the designer.
Package Library:
This method is part of the System.ComponentModel.Design namespace in the .NET Framework.
C# (CSharp) IDesignerHost.GetDesigner - 52 examples found. These are the top rated real world C# (CSharp) examples of IDesignerHost.GetDesigner extracted from open source projects. You can rate examples to help us improve the quality of examples.