'宣言 Public ReadOnly Property Items As GalleryToolItemCollection
public GalleryToolItemCollection Items {get;}
Imports Infragistics.Win.UltraWinToolbars Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button6.Click ' Get the gallery from the toolbars manager whose group will be customized Dim gallery As PopupGalleryTool = Me.UltraToolbarsManager1.Tools("PopupGalleryTool1") ' Keep a reference to the first group in the gallery Dim group As GalleryToolItemGroup = gallery.Groups(0) ' Add a new item to the gallery gallery.Items.Add("NewItem") ' Add the new item to the Items collection of the group group.Items.Add("NewItem") ' All items in the group will have red text group.ItemSettings.Appearance.ForeColor = Color.Red ' Customize the appearance of the header of the group group.Settings.HeaderAppearance.BackColor = Color.Teal group.Settings.HeaderAppearance.BackColor2 = Color.Blue group.Settings.HeaderAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal group.Settings.HeaderAppearance.ForeColor = Color.White ' Customize the appearance of the area behind the items in the gallery group.Settings.ItemAreaAppearance.BackColor = Color.Silver group.Settings.ItemAreaAppearance.BackColor2 = Color.Black group.Settings.ItemAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.ForwardDiagonal ' Change the text displaysed in the header of the group group.Text = "Customized Gallery" ' Keep a reference to the second group in the gallery Dim group2 As GalleryToolItemGroup = gallery.Groups(1) ' Hide the header of the second group group2.Settings.ShowHeader = Infragistics.Win.DefaultableBoolean.False End Sub
using System.Windows.Forms; using Infragistics.Win.UltraWinToolbars; private void button6_Click( object sender, EventArgs e ) { // Get the gallery from the toolbars manager whose group will be customized PopupGalleryTool gallery = (PopupGalleryTool)this.ultraToolbarsManager1.Tools[ "PopupGalleryTool1" ]; // Keep a reference to the first group in the gallery GalleryToolItemGroup group = gallery.Groups[ 0 ]; // Add a new item to the gallery gallery.Items.Add( "NewItem" ); // Add the new item to the Items collection of the group group.Items.Add( "NewItem" ); // All items in the group will have red text group.ItemSettings.Appearance.ForeColor = Color.Red; // Customize the appearance of the header of the group group.Settings.HeaderAppearance.BackColor = Color.Teal; group.Settings.HeaderAppearance.BackColor2 = Color.Blue; group.Settings.HeaderAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal; group.Settings.HeaderAppearance.ForeColor = Color.White; // Customize the appearance of the area behind the items in the gallery group.Settings.ItemAreaAppearance.BackColor = Color.Silver; group.Settings.ItemAreaAppearance.BackColor2 = Color.Black; group.Settings.ItemAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.ForwardDiagonal; // Change the text displaysed in the header of the group group.Text = "Customized Gallery"; // Keep a reference to the second group in the gallery GalleryToolItemGroup group2 = gallery.Groups[ 1 ]; // Hide the header of the second group group2.Settings.ShowHeader = Infragistics.Win.DefaultableBoolean.False; }