'宣言 Public ReadOnly Property GroupSettings As GalleryToolItemGroupSettings
public GalleryToolItemGroupSettings GroupSettings {get;}
Imports Infragistics.Win.UltraWinToolbars Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button8.Click ' Get the gallery from the toolbars manager which will be customized Dim gallery As PopupGalleryTool = Me.UltraToolbarsManager1.Tools("PopupGalleryTool1") ' Set the appearance of the filter bar in the gallery drop down. gallery.FilterBarAppearance.BackColor = Color.Orange gallery.FilterBarAppearance.BackColor2 = Color.Yellow gallery.FilterBarAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.GlassTop37 ' Set the appearance of the filter bar when the mouse is over it in the gallery drop down gallery.HotTrackFilterBarAppearance.ForeColor = Color.White ' Leave 15 pixels between the left edge of the drop down and the items in a group. gallery.GroupItemAreaPadding.Left = 15 ' Set the appearance of the area behind the items in all groups of the gallery drop down gallery.GroupSettings.ItemAreaAppearance.BackColor = Color.LightGray ' Leave 10 pixels below each item in the gallery drop down and preview gallery.ItemPadding.Bottom = 10 ' Set the display of selected items to select the image only. For items to be selected, ' the ItemStyle must be set to StateButton. ' Note: With this selection display style, if there is no image, the selection will not be displayed. gallery.ItemStyle = ItemStyle.StateButton gallery.ItemSettings.SelectionDisplayStyle = SelectionDisplayStyle.HighlightImageOnly ' Set the size of the items in the drop down and preview separately. If these size are not ' set, the size will be calculated automatically based on the contents of all items. gallery.ItemSizeInDropDown = New Size(50, 50) gallery.ItemSizeInPreview = New Size(25, 25) ' Set the min, max, and preferred drop down columns. If the min and max are the same, the gallery ' drop down will only be resizable vertically. ' Note: If UltraToolbarsManager.Office2007UICompatibility is true, these values may be increased ' so the gallery drop down always occludes the gallery preview. gallery.MinDropDownColumns = 2 gallery.PreferredDropDownColumns = 3 gallery.MaxDropDownColumns = 8 ' Set the min and max gallery preview columns. When resizing the ribbon smaller, if the min columns can ' no longer fit, the gallery will be changed to a gallery drop down button (if it is smaller). gallery.MinPreviewColumns = 3 gallery.MaxPreviewColumns = 5 ' Set the appearance of the gallery preview in the ribbon gallery.PreviewItemAreaAppearance.BackColor = Color.LightYellow gallery.PreviewItemAreaAppearance.BackColor2 = Color.SkyBlue gallery.PreviewItemAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump ' Set the appearance of the hot tracked gallery preview in the ribbon gallery.HotTrackPreviewItemAreaAppearance.BackColor = Color.SkyBlue gallery.HotTrackPreviewItemAreaAppearance.BackColor2 = Color.LightYellow gallery.HotTrackPreviewItemAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump ' Set the ShowItemText to Always so the text of gallery items display their titles and descriptions. ' Note: For the Always setting to take affect, UltraToolbarsManager.Office2007UICompatibility must ' be false. Otherwise, it will automatically be resolved to OnlyInDropDown. gallery.ToolbarsManager.Office2007UICompatibility = False gallery.ShowItemText = ShowGalleryItemText.Always End Sub
using System.Windows.Forms; using Infragistics.Win.UltraWinToolbars; private void button1_Click( object sender, EventArgs e ) { // Get the gallery from the toolbars manager which will be customized PopupGalleryTool gallery = (PopupGalleryTool)this.ultraToolbarsManager1.Tools[ "PopupGalleryTool1" ]; // Set the appearance of the filter bar in the gallery drop down. gallery.FilterBarAppearance.BackColor = Color.Orange; gallery.FilterBarAppearance.BackColor2 = Color.Yellow; gallery.FilterBarAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.GlassTop37; // Set the appearance of the filter bar when the mouse is over it in the gallery drop down gallery.HotTrackFilterBarAppearance.ForeColor = Color.White; // Leave 15 pixels between the left edge of the drop down and the items in a group. gallery.GroupItemAreaPadding.Left = 15; // Set the appearance of the area behind the items in all groups of the gallery drop down gallery.GroupSettings.ItemAreaAppearance.BackColor = Color.LightGray; // Leave 10 pixels below each item in the gallery drop down and preview gallery.ItemPadding.Bottom = 10; // Set the display of selected items to select the image only. For items to be selected, // the ItemStyle must be set to StateButton. // Note: With this selection display style, if there is no image, the selection will not be displayed. gallery.ItemStyle = ItemStyle.StateButton; gallery.ItemSettings.SelectionDisplayStyle = SelectionDisplayStyle.HighlightImageOnly; // Set the size of the items in the drop down and preview separately. If these size are not // set, the size will be calculated automatically based on the contents of all items. gallery.ItemSizeInDropDown = new Size( 50, 50 ); gallery.ItemSizeInPreview = new Size( 25, 25 ); // Set the min, max, and preferred drop down columns. If the min and max are the same, the gallery // drop down will only be resizable vertically. // Note: If UltraToolbarsManager.Office2007UICompatibility is true, these values may be increased // so the gallery drop down always occludes the gallery preview. gallery.MinDropDownColumns = 2; gallery.PreferredDropDownColumns = 3; gallery.MaxDropDownColumns = 8; // Set the min and max gallery preview columns. When resizing the ribbon smaller, if the min columns can // no longer fit, the gallery will be changed to a gallery drop down button (if it is smaller). gallery.MinPreviewColumns = 3; gallery.MaxPreviewColumns = 5; // Set the appearance of the gallery preview in the ribbon gallery.PreviewItemAreaAppearance.BackColor = Color.LightYellow; gallery.PreviewItemAreaAppearance.BackColor2 = Color.SkyBlue; gallery.PreviewItemAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump; // Set the appearance of the hot tracked gallery preview in the ribbon gallery.HotTrackPreviewItemAreaAppearance.BackColor = Color.SkyBlue; gallery.HotTrackPreviewItemAreaAppearance.BackColor2 = Color.LightYellow; gallery.HotTrackPreviewItemAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump; // Set the ShowItemText to Always so the text of gallery items display their titles and descriptions. // Note: For the Always setting to take affect, UltraToolbarsManager.Office2007UICompatibility must // be false. Otherwise, it will automatically be resolved to OnlyInDropDown. gallery.ToolbarsManager.Office2007UICompatibility = false; gallery.ShowItemText = ShowGalleryItemText.Always; }