'宣言 Public Class UltraExplorerBarKeyActionMapping Inherits Infragistics.Win.KeyActionMappingBase
public class UltraExplorerBarKeyActionMapping : Infragistics.Win.KeyActionMappingBase
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinExplorerBar Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button10.Click ' Add a key action mapping that will activate the first group in the control when the ' F3 key is pressed, but only when the control style is ExplorerBar and the control is ' not currently editing a Group or Item name. Dim myKeyActionMapping As UltraExplorerBarKeyActionMapping = _ New UltraExplorerBarKeyActionMapping(Keys.F3, _ UltraExplorerBarAction.ActivateFirstGroup, _ UltraExplorerBarStates.ActiveGroupIsFirstGroup Or UltraExplorerBarStates.InEditMode, _ UltraExplorerBarStates.ExplorerBarMode, _ 0, _ 0) Me.ultraExplorerBar1.KeyActionMappings.Add(myKeyActionMapping) ' Find the any keyaction mappings that invoke the ActivateLastGroup action and add disallowed ' and required states. Dim keyActionMapping As UltraExplorerBarKeyActionMapping For Each keyActionMapping In Me.ultraExplorerBar1.KeyActionMappings If (keyActionMapping.ActionCode = UltraExplorerBarAction.ActivateLastGroup) Then keyActionMapping.StateDisallowed = keyActionMapping.StateDisallowed Or UltraExplorerBarStates.ListbarMode keyActionMapping.StateRequired = keyActionMapping.StateRequired Or UltraExplorerBarStates.ActiveItemIsFirstItemInGroup End If Next End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinExplorerBar; private void button10_Click(object sender, System.EventArgs e) { // Add a key action mapping that will activate the first group in the control when the // F3 key is pressed, but only when the control style is ExplorerBar and the control is // not currently editing a Group or Item name. UltraExplorerBarKeyActionMapping myKeyActionMapping = new UltraExplorerBarKeyActionMapping(Keys.F3, UltraExplorerBarAction.ActivateFirstGroup, UltraExplorerBarStates.ActiveGroupIsFirstGroup | UltraExplorerBarStates.InEditMode, UltraExplorerBarStates.ExplorerBarMode, 0, 0); this.ultraExplorerBar1.KeyActionMappings.Add(myKeyActionMapping); // Find the any keyaction mappings that invoke the ActivateLastGroup action and add disallowed // and required states. foreach(UltraExplorerBarKeyActionMapping keyActionMapping in this.ultraExplorerBar1.KeyActionMappings) { if (keyActionMapping.ActionCode == UltraExplorerBarAction.ActivateLastGroup) { keyActionMapping.StateDisallowed |= UltraExplorerBarStates.ListbarMode; keyActionMapping.StateRequired |= UltraExplorerBarStates.ActiveItemIsFirstItemInGroup; } } }