using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraBars; using DevExpress.XtraBars.ViewInfo; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; using DevExpress.XtraEditors.Repository; using DevExpress.Utils; 构造函数#region 构造函数 public Form1() ...{ InitializeComponent(); barManager1.EditorKeyDown +=new KeyEventHandler(barManager1_EditorKeyDown); } #endregion 工具栏回车移动光标#region 工具栏回车移动光标 void barManager1_EditorKeyDown(object sender, KeyEventArgs e) ...{ BarManager barManager = sender as BarManager; if (barManager.ActiveEditItemLink.Bar == bar1 && e.KeyCode == Keys.Return) ...{ int index = bar1.ItemLinks.IndexOf(barManager.ActiveEditItemLink); while (index < bar1.ItemLinks.Count -1) ...{ index++; if (bar1.ItemLinks[index] is BarStaticItemLink) continue; else ...{ bar1.ItemLinks[index].Focus(); if (bar1.ItemLinks[index] is BarEditItemLink) barManager.ActiveEditItemLink.ShowEditor(); elseif (bar1.ItemLinks[index] is BarButtonItemLink) ...{ BarSelectionInfo info = barManager.InternalGetService(typeof(BarSelectionInfo)) as BarSelectionInfo; info.ClickLink(bar1.ItemLinks[index]); } e.Handled =true; break; } } } } #endregion