Property DesignerHost
- Namespace
- Alternet.FormDesigner.WinForms
- Assembly
- Alternet.FormDesigner.v9.dll
DesignerHost
Provides an interface for managing designer transactions and components.
[Browsable(false)]
public IDesignerHost DesignerHost { get; }
Property Value
Examples
Here is how to use a DesignerHost in the C# code:
using System.Collections.Generic;
using System.ComponentModel;
using Alternet.FormDesigner.WinForms;
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
var formDesigner = new FormDesignerControl();
formDesigner.AutoSaveToSource = false;
formDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
formDesigner.Parent = this;
IList<IComponent> list = new List<IComponent>();
foreach (IComponent component in formDesigner.DesignerHost.Container.Components)
{
list.Add(component);
}
}
}
Here is how to use a DesignerHost in the Visual Basic code:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports Alternet.FormDesigner.WinForms
Partial Public Class Form1
Inherits Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim formDesigner = New FormDesignerControl()
formDesigner.AutoSaveToSource = False
formDesigner.Dock = System.Windows.Forms.DockStyle.Fill
formDesigner.Parent = Me
Dim list As IList(Of IComponent) = New List(Of IComponent)()
For Each component As IComponent In formDesigner.DesignerHost.Container.Components
list.Add(component)
Next
End Sub
End Class
Remarks
DesignerHost works with the WinForms designer architecture to support the designer transaction and component management. You can get an object that implements IDesignerHost by calling <xref:System.ComponentModel.Design.DesignSurface.GetService*> method.