'宣言 Public Event GalleryToolActiveItemChange As GalleryToolItemEventHandler
public event GalleryToolItemEventHandler GalleryToolActiveItemChange
イベント ハンドラが、このイベントに関連するデータを含む、GalleryToolItemEventArgs 型の引数を受け取りました。次の GalleryToolItemEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
GalleryTool | このイベントに関連付けられたギャラリー ツールを取得します。 |
Group | 項目が属するグループを取得します。ItemLocation が Preview の時にこれは適用されません。 |
Item | イベントに関連付けられた項目を取得します。 |
ItemLocation | 項目のギャラリーの位置を取得します。 |
Imports Infragistics.Win.UltraWinToolbars Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button5.Click ' Get the gallery from the toolbars manager whose item will be customized Dim gallery As PopupGalleryTool = Me.UltraToolbarsManager1.Tools("PopupGalleryTool1") ' Set the delay for activating the first item in the gallery. The user can mouse over ' various items, but if they leave the item before 1000ms has ellapsed, the ' GalleryToolActiveItemChange event will never fire. However, if the user does hover ' over an item for 1000ms, the event will fire and the ActivationActionDelay will be used ' to determine how long to wait to activate other items. ' NOTE: When UltraToolbarsManager.Office2007UICompatibility is true, these delays will ' automatically be resolved to 250ms and 0ms, respectively, for gallery previews in the ribbon. gallery.ActivationInitialActionDelay = 1000 ' After the first item has been activated, subsequent items will be activated immediately gallery.ActivationActionDelay = 0 End Sub Private Sub UltraToolbarsManager1_GalleryToolActiveItemChange(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinToolbars.GalleryToolItemEventArgs) Handles UltraToolbarsManager1.GalleryToolActiveItemChange ' The Item property needs to be checked for Nothing, because when an item has been ' activated, and the cursor has left the item area of the gallery, this event ' will be fired with a Nothing Item. If Not (e.Item Is Nothing) Then ' Use the information from the event args to get the ui element showing the ' item that was activated. Dim itemElement As Infragistics.Win.UIElement = e.Item.GetUIElement(e.GalleryTool, e.Group, e.ItemLocation) ' Determine the screen location of the item's top-left corner Dim screenLocation As Point = itemElement.Control.PointToScreen(itemElement.Rect.Location) ' Set the text of the form to indicate which item has been activated ' and where it is location, both the screen location and the type of ' gallery area it was displayed in (preview or drop down). Me.Text = _ "Live Preview activated for """ & e.Item.Title & """ in the " & _ e.ItemLocation.ToString() & " area at " & screenLocation.ToString() Else ' If the Item is Nothing, the the cursor has left the item area and there ' is no longer an active item. Me.Text = "Live Preview deactivated from the " & e.ItemLocation.ToString() & " area" End If 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 delay for activating the first item in the gallery. The user can mouse over // various items, but if they leave the item before 1000ms has ellapsed, the // GalleryToolActiveItemChange event will never fire. However, if the user does hover // over an item for 1000ms, the event will fire and the ActivationActionDelay will be used // to determine how long to wait to activate other items. // NOTE: When UltraToolbarsManager.Office2007UICompatibility is true, these delays will // automatically be resolved to 250ms and 0ms, respectively, for gallery previews in the ribbon. gallery.ActivationInitialActionDelay = 1000; // After the first item has been activated, subsequent items will be activated immediately gallery.ActivationActionDelay = 0; } private void ultraToolbarsManager1_GalleryToolActiveItemChange( object sender, GalleryToolItemEventArgs e ) { // The Item property needs to be checked for null, because when an item has been // activated, and the cursor has left the item area of the gallery, this event // will be fired with a null Item. if ( e.Item != null ) { // Use the information from the event args to get the ui element showing the // item that was activated. Infragistics.Win.UIElement itemElement = e.Item.GetUIElement( e.GalleryTool, e.Group, e.ItemLocation ); // Determine the screen location of the item's top-left corner Point screenLocation = itemElement.Control.PointToScreen( itemElement.Rect.Location ); // Set the text of the form to indicate which item has been activated // and where it is location, both the screen location and the type of // gallery area it was displayed in (preview or drop down). this.Text = "Live Preview activated for \"" + e.Item.Title + "\" in the " + e.ItemLocation.ToString() + " area at " + screenLocation.ToString(); } else { // If the Item is null, the the cursor has left the item area and there // is no longer an active item. this.Text = "Live Preview deactivated from the " + e.ItemLocation.ToString() + " area"; } }