[]
You can create a toolbar at design time or through code. Click on either of the following links to expand the steps for the designer or for the code.
To create a toolbar at design time
To create a C1ToolBar using its Link to Command designer, complete the following steps;.
At run time, the toolbar appears like the following image:
To create a toolbar programmatically
To programmatically create a C1ToolBar with text buttons, complete the following steps:
Add the C1.Win.C1Command namespace to your references in your project.
Declare the namespace in your source file, then add a C1CommandHolder to hold the toolbar.
To write code in Visual Basic
Imports C1.Win.C1Command
Dim ch As C1CommandHolder = C1CommandHolder.CreateCommandHolder(Me)
To write code in C#
using C1.Win.C1Command;
C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this);
Create a new C1ToolBar, then add the C1ToolBar on your form.
To write code in Visual Basic
Dim tb As New C1ToolBar()
Me.Controls.Add(tb)
To write code in C#
C1ToolBar tb = new C1ToolBar();
this.Controls.Add(tb);
Assign the C1CommandHolder to the C1ToolBar, then create a new command for the toolbar. The name for the new command will be called File.
To write code in Visual Basic
tb.CommandHolder = ch
Dim cFile As New C1Command()
cFile.Text = "File"
To write code in C#
tb.CommandHolder = ch;
C1Command cFile = new C1Command();
cFile.Text = "File";
Create a new commandlink for the new command in the toolbar, then add the new commandlink to the toolbar.
To write code in Visual Basic
Dim cl As C1CommandLink
cl = New C1CommandLink(cFile)
tb.CommandLinks.Add(cl)
To write code in C#
C1CommandLink cl = new C1CommandLink(cFile);
tb.CommandLinks.Add(cl);
Make the commandlink appear as text, then create another command for the toolbar and call it View.
To write code in Visual Basic
cl.ButtonLook = ButtonLookFlags.Text
Dim cView As New C1Command()
cView.Text = "View"
To write code in C#
cl.ButtonLook = ButtonLookFlags.Text;
C1Command cView = new C1Command();
cView.Text = "View";
Create a new commandlink for the new command, View, then add it to the toolbar.
To write code in Visual Basic
cl = New C1CommandLink(cView)
tb.CommandLinks.Add(cl)
To write code in C#
cl = new C1CommandLink(cView);
tb.CommandLinks.Add(cl);
Make the commandlink for View appear as text, then create another command and call it Edit.
To write code in Visual Basic
cl.ButtonLook = ButtonLookFlags.Text
Dim mEdit As New C1Command()
mEdit.Text = "Edit"
To write code in C#
cl.ButtonLook = ButtonLookFlags.Text;
C1Command mEdit = new C1Command();
mEdit.Text = "Edit";
Create a new commandlink for the new command, Edit, then add the commandlink to the toolbar.
To write code in Visual Basic
cl = New C1CommandLink(mEdit)
tb.CommandLinks.Add(cl)
To write code in C#
cl = new C1CommandLink(mEdit);
tb.CommandLinks.Add(cl);
Make the command link for the edit toolbar button to appear as text.
To write code in Visual Basic
vbnet cl.ButtonLook = ButtonLookFlags.Text
To write code in C#
csharp cl.ButtonLook = ButtonLookFlags.Text;
The toolbar appears like the following: