#region using System.Windows.Forms; using CSFrameworkV5.Business; using CSFrameworkV5.Core; using CSFrameworkV5.Language; using DevExpress.LookAndFeel; using DevExpress.XtraEditors; using DevExpress.XtraGrid; #endregion namespace CSFrameworkV5.Library { /// /// 所有窗体基类,继承XtraForm用于设置皮肤 /// public partial class frmBase : XtraForm, IFormBase, ILanguageSupport { /// /// 按回车键自动将焦点移到下一输入框 /// protected bool _EnterFocusNextControl = true; public frmBase() { InitializeComponent(); } #region ILanguageSupport 成员 /// /// 接口的方法,设置当前窗体的语言 /// public virtual void SetLanguage() { Text = LanLib.Get(LanLib.Current, GetType().FullName, Text); LanTool.SetLanguage(this); } #endregion /// /// 处理热键 /// /// protected virtual void DoHotkey(char key) { // } /// /// 处理回车键或系统热键 /// /// /// private void frmBase_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter && _EnterFocusNextControl) { if (ActiveControl is Form) return; if (ActiveControl != null && ActiveControl is MemoEdit) return; if (ActiveControl != null && ActiveControl is TextBox && ((TextBox)ActiveControl).Multiline) return; if (ActiveControl != null && ActiveControl is UserControl) return; if (ActiveControl != null && ActiveControl is GridControl) return; //注意:不处理表格的按键,在派生类处理,如明细表 SendKeys.Send("{Tab}"); //发送Tab键 } else //其它键,作为系统热键处理 { DoHotkey(e.KeyChar); } } #region IFormBase 成員 /// /// 加载皮肤 /// public void LoadSkin() { UserLookAndFeel.Default.SetSkinStyle(UserConfig.Current .SkinName); //设置主题样式 } /// /// 设置窗体皮肤 /// /// 名称 public void SetSkin(string skinName) { UserLookAndFeel.Default.SetSkinStyle(skinName); //设置主题样式 } #endregion } }