📄 dlgfrmsysset.cs
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;namespace WWAM.Forms.Dlg{ public class DlgFrmSysSet : WWAM.Forms.Dlg.DlgBase {
#region DlgFrmSysSet
private DevExpress.XtraEditors.SimpleButton btnActive;
private DevExpress.XtraEditors.RadioGroup txtSingleMode;
private DevExpress.XtraEditors.ComboBoxEdit txtDefaultPaper;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2; private System.ComponentModel.IContainer components = null; public DlgFrmSysSet() { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } public DlgFrmSysSet(Forms.FrmMain form):base(form) { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); mainForm = form; // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.btnActive = new DevExpress.XtraEditors.SimpleButton();
this.txtSingleMode = new DevExpress.XtraEditors.RadioGroup();
this.txtDefaultPaper = new DevExpress.XtraEditors.ComboBoxEdit();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.txtSingleMode.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtDefaultPaper.Properties)).BeginInit();
this.SuspendLayout();
//
// btnAccept
//
this.btnAccept.Location = new System.Drawing.Point(32, 112);
this.btnAccept.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
this.btnAccept.LookAndFeel.UseWindowsXPTheme = false;
this.btnAccept.Name = "btnAccept";
this.btnAccept.TabIndex = 2;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(128, 112);
this.btnCancel.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
this.btnCancel.LookAndFeel.UseWindowsXPTheme = false;
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 3;
//
// btnActive
//
this.btnActive.Enabled = false;
this.btnActive.Location = new System.Drawing.Point(224, 112);
this.btnActive.Name = "btnActive";
this.btnActive.TabIndex = 4;
this.btnActive.Text = "应用";
this.btnActive.Click += new System.EventHandler(this.btnActive_Click);
//
// txtSingleMode
//
this.txtSingleMode.Location = new System.Drawing.Point(32, 32);
this.txtSingleMode.Name = "txtSingleMode";
//
// txtSingleMode.Properties
//
this.txtSingleMode.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] {
new DevExpress.XtraEditors.Controls.RadioGroupItem(false, "网络版"),
new DevExpress.XtraEditors.Controls.RadioGroupItem(true, "单机版")});
this.txtSingleMode.Size = new System.Drawing.Size(88, 56);
this.txtSingleMode.TabIndex = 0;
this.txtSingleMode.EditValueChanged += new System.EventHandler(this.Control_EditValueChanged);
//
// txtDefaultPaper
//
this.txtDefaultPaper.EditValue = "";
this.txtDefaultPaper.EnterMoveNextControl = true;
this.txtDefaultPaper.Location = new System.Drawing.Point(144, 32);
this.txtDefaultPaper.Name = "txtDefaultPaper";
//
// txtDefaultPaper.Properties
//
this.txtDefaultPaper.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.txtDefaultPaper.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
this.txtDefaultPaper.Size = new System.Drawing.Size(136, 21);
this.txtDefaultPaper.TabIndex = 1;
this.txtDefaultPaper.EditValueChanged += new System.EventHandler(this.Control_EditValueChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 16);
this.label1.TabIndex = 5;
this.label1.Text = "工作模式:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(128, 8);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 16);
this.label2.TabIndex = 6;
this.label2.Text = "默认报刊:";
//
// DlgFrmSysSet
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(314, 152);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtDefaultPaper);
this.Controls.Add(this.txtSingleMode);
this.Controls.Add(this.btnActive);
this.Name = "DlgFrmSysSet";
this.Controls.SetChildIndex(this.btnActive, 0);
this.Controls.SetChildIndex(this.txtSingleMode, 0);
this.Controls.SetChildIndex(this.txtDefaultPaper, 0);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.btnCancel, 0);
this.Controls.SetChildIndex(this.btnAccept, 0);
this.Controls.SetChildIndex(this.label2, 0);
((System.ComponentModel.ISupportInitialize)(this.txtSingleMode.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtDefaultPaper.Properties)).EndInit();
this.ResumeLayout(false);
} #endregion
#endregion
#region Variable
Forms.FrmMain mainForm; #endregion
#region CanClose
protected override bool CanClose()
{
if(this.btnActive.Enabled)
this.SaveSetting();
return base.CanClose ();
}
#endregion
#region OnFormShow
protected override void OnFormShow()
{
base.OnFormShow ();
this.btnActive.Enabled = false;
this.txtSingleMode.Focus();
}
#endregion
#region ShowDialog
public new DialogResult ShowDialog()
{
this.ComboDataBind(this.txtDefaultPaper,this.mainForm.DB.RunCmdGetTable("select Code from bType where Type = 1",0),"Code");
LoadSetting();
return base.ShowDialog();
}
#endregion
#region Control Event
private void Control_EditValueChanged(object sender, System.EventArgs e)
{
this.btnActive.Enabled = true;
} private void btnActive_Click(object sender, System.EventArgs e)
{
this.SaveSetting();
this.btnActive.Enabled =false;
} #endregion #region Method void LoadSetting() { this.txtSingleMode.EditValue = this.mainForm.SysSet.SingleMode; this.txtDefaultPaper.Text = this.mainForm.SysSet.DefaultPaper; } void SaveSetting() { this.mainForm.SysSet.SingleMode = (bool)this.txtSingleMode.EditValue; this.mainForm.SysSet.DefaultPaper = this.txtDefaultPaper.Text; this.mainForm.RefreshSetting(); } #endregion
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -