'宣言 Public Property SelectionDisplayStyle As SelectionDisplayStyle
public SelectionDisplayStyle SelectionDisplayStyle {get; set;}
Imports Infragistics.Win.UltraWinToolbars Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click ' Get the gallery from the toolbars manager whose item will be customized Dim gallery As PopupGalleryTool = Me.UltraToolbarsManager1.Tools("PopupGalleryTool1") ' Set the item style of the gallery to StateButton so when items are ' clicking it the gallery, they display selected gallery.ItemStyle = ItemStyle.StateButton ' Keep a reference to the first item in the gallery Dim item As GalleryToolItem = gallery.Items(0) ' Set the columns span to two. This will cause the item to span the width ' of two normal sized items item.ColumnSpan = 2 ' Set the formatted description on this item. ' This will appear beneath the title. item.Description = "<p style=""text-align:Right""><b>Bold</b><br/><i>Italics</i><br/><u>Underline</u></p>" ' Set the title on the gallery item. This will display in bold because the ' item also has a description. item.Title = "Gallery Item With Formatted Description" ' Set the image of the item. This image will display to the left of the ' title and description by default, but this is changed below. item.Settings.Appearance.Image = New Bitmap("C:\myItem.png") ' Set the image area size. Regardless of the size of the image, the space ' allocated to display the image will be 50x50. item.Settings.ImageAreaSize = New Size(50, 50) ' Set the image padding. The image will be shifted so there are 10 pixels ' between the image and the right edge of the image area. item.Settings.ImagePadding.Right = 10 ' Set the selection display style. This affects the display of the item ' when it is the selected item in the gallery. ' Note: This setting only applies when the ItemStyle of the gallery is StateButton. item.Settings.SelectionDisplayStyle = SelectionDisplayStyle.HighlightImageOnly ' Set the text placement of the item so the title and description show ' to the left of the image. item.Settings.TextPlacement = Infragistics.Win.TextPlacement.LeftOfImage ' Set the text to appear in the tool tip for the gallery item when the cursor ' hovers over it. This will actually not be seen in this example because ' the ToolTipTextFormatted is being set below, which shows instead of the the ' ToolTipText if it is set. item.ToolTipText = "This gallery item has a formatted description" ' Set the formatted text to appear. You can edit this property with the formatted ' text editor and use many formatting tags used in HTML. If both ToolTipTextFormatted ' and ToolTipText are set, only the ToolTipTextFormatted will be seen. item.ToolTipTextFormatted = "<i>This</i> gallery item has a <b>formatted</b> description" ' Set the title of the tool tip. This will appear in bold above the tool tip text (or formatted text) item.ToolTipTitle = "Gallery Item 1" 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 whose item will be customized PopupGalleryTool gallery = (PopupGalleryTool)this.ultraToolbarsManager1.Tools[ "PopupGalleryTool1" ]; // Set the item style of the gallery to StateButton so when items are // clicking it the gallery, they display selected gallery.ItemStyle = ItemStyle.StateButton; // Keep a reference to the first item in the gallery GalleryToolItem item = gallery.Items[ 0 ]; // Set the columns span to two. This will cause the item to span the width // of two normal sized items item.ColumnSpan = 2; // Set the formatted description on this item. // This will appear beneath the title. item.Description = "<p style=\"text-align:Right;\"><b>Bold</b><br/><i>Italics</i><br/><u>Underline</u></p>"; // Set the title on the gallery item. This will display in bold because the // item also has a description. item.Title = "Gallery Item With Formatted Description"; // Set the image of the item. This image will display to the left of the // title and description by default, but this is changed below. item.Settings.Appearance.Image = new Bitmap( "C:\\myItem.png" ); // Set the image area size. Regardless of the size of the image, the space // allocated to display the image will be 50x50. item.Settings.ImageAreaSize = new Size( 50, 50 ); // Set the image padding. The image will be shifted so there are 10 pixels // between the image and the right edge of the image area. item.Settings.ImagePadding.Right = 10; // Set the selection display style. This affects the display of the item // when it is the selected item in the gallery. // Note: This setting only applies when the ItemStyle of the gallery is StateButton. item.Settings.SelectionDisplayStyle = SelectionDisplayStyle.HighlightImageOnly; // Set the text placement of the item so the title and description show // to the left of the image. item.Settings.TextPlacement = Infragistics.Win.TextPlacement.LeftOfImage; // Set the text to appear in the tool tip for the gallery item when the cursor // hovers over it. This will actually not be seen in this example because // the ToolTipTextFormatted is being set below, which shows instead of the the // ToolTipText if it is set. item.ToolTipText = "This gallery item has a formatted description"; // Set the formatted text to appear. You can edit this property with the formatted // text editor and use many formatting tags used in HTML. If both ToolTipTextFormatted // and ToolTipText are set, only the ToolTipTextFormatted will be seen. item.ToolTipTextFormatted = "<i>This</i> gallery item has a <b>formatted</b> description"; // Set the title of the tool tip. This will appear in bold above the tool tip text (or formatted text) item.ToolTipTitle = "Gallery Item 1"; }