Property ReferencedAssemblies
- Namespace
- Alternet.FormDesigner.WinForms
- Assembly
- Alternet.FormDesigner.v9.dll
ReferencedAssemblies
Gets collection of assemblies where the controls and components used on the form being designed are declared.
[Browsable(false)]
public DesignerReferencedAssemblies ReferencedAssemblies { get; set; }
Property Value
Examples
Here is how to use a ReferencedAssemblies in the C# code:
using System.IO;
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;
string fileName = "myfile.vb";
formDesigner.ReferencedAssemblies = GetReferencedAssemblies(fileName);
}
private DesignerReferencedAssemblies GetReferencedAssemblies(string fileName)
{
var defaultReferences = Path.GetExtension(fileName).ToLower().Equals(".vb") ?
DesignerReferencedAssemblies.DefaultForVisualBasic :
DesignerReferencedAssemblies.DefaultForCSharp;
return defaultReferences;
}
}
Here is how to use a ReferencedAssemblies in the Visual Basic code:
Imports System
Imports System.IO
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 fileName As String = "myfile.vb"
formDesigner.ReferencedAssemblies = GetReferencedAssemblies(fileName)
End Sub
Private Function GetReferencedAssemblies(ByVal fileName As String) As DesignerReferencedAssemblies
Dim defaultReferences = If(Path.GetExtension(fileName).ToLower().Equals(".vb"), DesignerReferencedAssemblies.DefaultForVisualBasic, DesignerReferencedAssemblies.DefaultForCSharp)
Return defaultReferences
End Function
End Class
Remarks
ReferencedAssemblies contains a list of assembly names as well as a list of search paths and the path to the current framework. You can change the assembly name list or search path list by using the AddAssemblyName or AddSearchPath methods.