'宣言 Public Overloads Function Add( _ ByVal key As String, _ ByVal text As String _ ) As UltraExplorerBarItem
public UltraExplorerBarItem Add( string key, string text )
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinExplorerBar Private Sub Button88_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button88.Click ' Add items to the Items collection using the different overloads. ' Can't proceed unless we have at least 1 group. If (Me.ultraExplorerBar1.Groups.Count < 1) Then Return End If ' Items.Add() Dim item As UltraExplorerBarItem = Me.ultraExplorerBar1.Groups(0).Items.Add() item.Text = "FirstItemAdded" ' Items.Add(UltraExplorerBarItem item) item = New UltraExplorerBarItem("SecondItemKey") item.Text = "SecondItemAdded" Dim index As Integer = Me.ultraExplorerBar1.Groups(0).Items.Add(item) ' Items.Add(string Key, string Text) item = Me.ultraExplorerBar1.Groups(0).Items.Add("ThirdItemKey", "ThirdItem") ' Items.Add(string Key) item = Me.ultraExplorerBar1.Groups(0).Items.Add("FourthItemKey") ' Items.Add(string Key) Dim item1 As UltraExplorerBarItem = New UltraExplorerBarItem() Dim item2 As UltraExplorerBarItem = New UltraExplorerBarItem() Dim item3 As UltraExplorerBarItem = New UltraExplorerBarItem() Dim item4 As UltraExplorerBarItem = New UltraExplorerBarItem() Me.ultraExplorerBar1.Groups(0).Items.AddRange(New UltraExplorerBarItem() {item1, item2, item3, item4}) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinExplorerBar; private void button88_Click(object sender, System.EventArgs e) { // Add items to the Items collection using the different overloads. // Can't proceed unless we have at least 1 group. if (this.ultraExplorerBar1.Groups.Count < 1) return; // Items.Add() UltraExplorerBarItem item = this.ultraExplorerBar1.Groups[0].Items.Add(); item.Text = "FirstItemAdded"; // Items.Add(UltraExplorerBarItem item) item = new UltraExplorerBarItem("SecondItemKey"); item.Text = "SecondItemAdded"; int index = this.ultraExplorerBar1.Groups[0].Items.Add(item); // Items.Add(string Key, string Text) item = this.ultraExplorerBar1.Groups[0].Items.Add("ThirdItemKey", "ThirdItem"); // Items.Add(string Key) item = this.ultraExplorerBar1.Groups[0].Items.Add("FourthItemKey"); // Items.Add(string Key) UltraExplorerBarItem item1 = new UltraExplorerBarItem(); UltraExplorerBarItem item2 = new UltraExplorerBarItem(); UltraExplorerBarItem item3 = new UltraExplorerBarItem(); UltraExplorerBarItem item4 = new UltraExplorerBarItem(); this.ultraExplorerBar1.Groups[0].Items.AddRange(new UltraExplorerBarItem [] { item1, item2, item3, item4 } ); }