#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
|
{
|
/// <summary>
|
/// 所有窗体基类,继承XtraForm用于设置皮肤
|
/// </summary>
|
public partial class frmBase : XtraForm, IFormBase, ILanguageSupport
|
{
|
/// <summary>
|
/// 按回车键自动将焦点移到下一输入框
|
/// </summary>
|
protected bool _EnterFocusNextControl = true;
|
|
public frmBase()
|
{
|
InitializeComponent();
|
}
|
|
#region ILanguageSupport 成员
|
|
/// <summary>
|
/// 接口的方法,设置当前窗体的语言
|
/// </summary>
|
public virtual void SetLanguage()
|
{
|
Text = LanLib.Get(LanLib.Current, GetType().FullName, Text);
|
LanTool.SetLanguage(this);
|
}
|
|
#endregion
|
|
/// <summary>
|
/// 处理热键
|
/// </summary>
|
/// <param name="key"></param>
|
protected virtual void DoHotkey(char key)
|
{
|
//
|
}
|
|
/// <summary>
|
/// 处理回车键或系统热键
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
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 成員
|
|
/// <summary>
|
/// 加载皮肤
|
/// </summary>
|
public void LoadSkin()
|
{
|
UserLookAndFeel.Default.SetSkinStyle(UserConfig.Current
|
.SkinName); //设置主题样式
|
}
|
|
/// <summary>
|
/// 设置窗体皮肤
|
/// </summary>
|
/// <param name="skinName">名称</param>
|
public void SetSkin(string skinName)
|
{
|
UserLookAndFeel.Default.SetSkinStyle(skinName); //设置主题样式
|
}
|
|
#endregion
|
}
|
}
|