This topic demonstrates how to make the C1ToolBar appear like the default toolbar in IE by using the ButtonLookFlags enumeration. The ButtonLookFlags enumeration contains the parameters: Text, TextAndImage, Image, and Default. These parameters give you the ability to modify your toolbar button to show text, text and an image, or just an image.
The following code demonstrates how you can make the C1ToolBar appear like the default toolbar in IE. The following example uses all of the parameters (TextAndImage, Image, Default, and Text) contained in the ButtonLookFlags enumeration to make the C1ToolBar appear similar to the IE toolbar:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim ch As C1CommandHolder = C1CommandHolder.CreateCommandHolder(Me) Dim tb As New C1ToolBar() Me.Controls.Add(tb) tb.CommandHolder = ch Dim cNew As New C1Command() Dim cl As C1CommandLink cNew.Text = "New" cNew.Image = System.Drawing.Image.FromFile("C:\Images\New.bmp") cl = New C1CommandLink(cNew) tb.CommandLinks.Add(cl) 'Use the ButtonLookFlags enumeration to make the toolbar button appear as an image cl.ButtonLook = ButtonLookFlags.Image |
To write code in C#
C# |
Copy Code
|
---|---|
C1CommandHolder ch = C1CommandHolder.CreateCommandHolder(this); C1ToolBar tb = new C1ToolBar(); this.Controls.Add(tb); tb.CommandHolder = ch; C1Command cNew = new C1Command(); cNew.Text = " New "; cl = new C1CommandLink(cNew); tb.Commandlinks.Add(cl); //Use the ButtonLookFlags enumeration to make the toolbar button appear as an image cl.ButtonLook = ButtonLookFlags.Image; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim cOpen As New C1Command() cOpen.Text = "Open" cl = New C1CommandLink(cOpen) cOpen.Image = System.Drawing.Image.FromFile("C:\Images\FileOpen.bmp") tb.CommandLinks.Add(cl) 'Use the ButtonLookFlags enumeration to make the toolbar button appear as text and an image cl.ButtonLook = ButtonLookFlags.TextAndImage |
To write code in C#
C# |
Copy Code
|
---|---|
C1Command cOpen = new C1Command(); cOpen.Text = "Open"; cl = new C1CommandLink(cOpen); cOpen.Image = System.Drawing.Image.FromFile("C:\Images\FileOpen.bmp"); tb.CommandLinks.Add(cl); //Use the ButtonLookFlags enumeration to make the toolbar button appear as text and an image cl.ButtonLook = ButtonLookFlags.TextAndImage; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim cSave As New C1Command() cSave.Text = "Save" cl = New C1CommandLink(cSave) tb.CommandLinks.Add(cl) cSave.Image = System.Drawing.Image.FromFile("C:\Images\FileSave.bmp") 'Use the ButtonLookFlags enumeration to make the toolbar button appear as default cl.ButtonLook = ButtonLookFlags.Default |
To write code in C#
C# |
Copy Code
|
---|---|
C1Command cSave = new C1Command(); cSave.Text = "Save"; cl = new C1CommandLink(cSave); tb.CommandLinks.Add(cl); cSave.Image = System.Drawing.Image.FromFile("C:\Images\FileSave.bmp") //Use the ButtonLookFlags enumeration to make the toolbar button appear as default cl.ButtonLook = ButtonLookFlags.Default; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim cFavorites As New C1Command() cFavorites.Text = "Favorites" cl = New C1CommandLink(cFavorites) tb.CommandLinks.Add(cl) 'Use the ButtonLookFlags enumeration to make the toolbar button appear as text cl.ButtonLook = ButtonLookFlags.Text |
To write code in C#
C# |
Copy Code
|
---|---|
C1Command cFavorites = new C1Command(); cFavorites.Text = "Save"; cl = new C1CommandLink(cFavorites); tb.CommandLinks.Add(cl); //Use the ButtonLookFlags enumeration to make the toolbar button appear as text cl.ButtonLook = ButtonLookFlags.Text; |