📄 enginecheckbox.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SECompare.Structure;
namespace SECompare.Controls
{
public partial class EngineCheckBox : UserControl
{
public EngineCheckBox()
{
InitializeComponent();
//初始化复选框
this.InitializeCheckBoxes();
}
public new bool Enabled
{
get
{
return this.groupBox.Enabled;
}
set
{
this.groupBox.Enabled = value;
}
}
public EngineSetting Checked
{
get
{
EngineSetting es = new EngineSetting();
for (int i = 0; i < this.groupBox.Controls.Count; i++)
{
Control c = this.groupBox.Controls[i];
if (c.GetType().Name.Equals("CheckBox"))
{
if (((CheckBox)c).Checked)
es.Select(((CheckBox)c).Name);
else
es.DisSelect(((CheckBox)c).Name);
}
}
return es;
}
}
private void InitializeCheckBoxes()
{
String[] engines = Structure.EngineSetting.GetEngines();
EngineSetting es = new EngineSetting();
int i = 0;
foreach (String engine in engines)
{
CheckBox cb = new CheckBox();
cb.Name = engine;
cb.Text = engine;
cb.Location = new Point(10 + 80 * (i++), 20);
cb.Size = new Size(70, 25);
cb.Checked = es.IsSelected(EngineSetting.GetEnum(engine));
this.groupBox.Controls.Add(cb);
}
}
public bool IsChecked(EngineSet engine)
{
for (int i = 0; i < this.groupBox.Controls.Count; i++)
{
Control c = this.groupBox.Controls[i];
if (c.GetType().Name.Equals("CheckBox") && c.Name.Equals(engine.ToString()))
return ((CheckBox)c).Checked;
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -