Property CategoryNames
- Namespace
- Alternet.FormDesigner.WinForms
- Assembly
- Alternet.FormDesigner.v9.dll
CategoryNames
Gets collection of Categories (Tabs) displayed by the toolbox.
public CategoryNameCollection CategoryNames { get; }
Property Value
Examples
Here is how to use a CategoryNames in the C# code:
using System.Text;
using System.Windows.Forms;
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.Left;
formDesigner.Parent = this;
var toolboxControl = new ToolboxControl();
toolboxControl.Parent = this;
toolboxControl.Dock = System.Windows.Forms.DockStyle.Fill;
toolboxControl.FormDesignerControl = formDesigner;
MessageBox.Show(GetList(toolboxControl.CategoryNames));
}
private string GetList(CategoryNameCollection list)
{
var sb = new StringBuilder();
int i = 0;
foreach (var elem in list)
{
sb.Append(elem.ToString());
i++;
if (i < list.Count)
sb.Append(", ");
}
return sb.ToString();
}
}
Here is how to use a CategoryNames in the Visual Basic code:
Imports System
Imports System.Text
Imports System.Windows.Forms
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 = Windows.Forms.DockStyle.Left
formDesigner.Parent = Me
Dim toolboxControl = New ToolboxControl()
toolboxControl.Parent = Me
toolboxControl.Dock = Windows.Forms.DockStyle.Fill
toolboxControl.FormDesignerControl = formDesigner
MessageBox.Show(GetList(toolboxControl.CategoryNames))
End Sub
Private Function GetList(ByVal list As CategoryNameCollection) As String
Dim sb = New StringBuilder()
Dim i = 0
For Each elem In list
sb.Append(elem.ToString())
i += 1
If i < list.Count Then
sb.Append(", ")
End If
Next
Return sb.ToString()
End Function
End Class
Remarks
This property is used to store a list of toolbox category names.