📄 dincloumn.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 学生信息管理
{
/// <summary>
/// DinCloumn 的摘要说明。
/// </summary>
public class DinCloumn : System.Windows.Forms.Form
{
private System.Windows.Forms.CheckedListBox chkListBoxColumn;
private System.Windows.Forms.Button btnDo;
private System.Windows.Forms.Button btnRedo;
private System.Windows.Forms.Button btnSelectAll;
private System.Windows.Forms.CheckBox chkDetails;
private System.Windows.Forms.ComboBox cboList;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public DinCloumn()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DinCloumn));
this.chkListBoxColumn = new System.Windows.Forms.CheckedListBox();
this.btnDo = new System.Windows.Forms.Button();
this.btnRedo = new System.Windows.Forms.Button();
this.btnSelectAll = new System.Windows.Forms.Button();
this.chkDetails = new System.Windows.Forms.CheckBox();
this.cboList = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// chkListBoxColumn
//
this.chkListBoxColumn.Dock = System.Windows.Forms.DockStyle.Left;
this.chkListBoxColumn.HorizontalScrollbar = true;
this.chkListBoxColumn.Location = new System.Drawing.Point(0, 0);
this.chkListBoxColumn.Name = "chkListBoxColumn";
this.chkListBoxColumn.Size = new System.Drawing.Size(168, 244);
this.chkListBoxColumn.TabIndex = 0;
//
// btnDo
//
this.btnDo.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnDo.Location = new System.Drawing.Point(191, 10);
this.btnDo.Name = "btnDo";
this.btnDo.Size = new System.Drawing.Size(82, 32);
this.btnDo.TabIndex = 1;
this.btnDo.Text = "应用";
this.btnDo.Click += new System.EventHandler(this.btnDo_Click);
//
// btnRedo
//
this.btnRedo.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnRedo.Location = new System.Drawing.Point(191, 110);
this.btnRedo.Name = "btnRedo";
this.btnRedo.Size = new System.Drawing.Size(82, 32);
this.btnRedo.TabIndex = 2;
this.btnRedo.Text = "取消";
this.btnRedo.Click += new System.EventHandler(this.btnRedo_Click);
//
// btnSelectAll
//
this.btnSelectAll.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSelectAll.Location = new System.Drawing.Point(191, 60);
this.btnSelectAll.Name = "btnSelectAll";
this.btnSelectAll.Size = new System.Drawing.Size(82, 32);
this.btnSelectAll.TabIndex = 4;
this.btnSelectAll.Text = "全选";
this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click);
//
// chkDetails
//
this.chkDetails.Checked = true;
this.chkDetails.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkDetails.Location = new System.Drawing.Point(175, 170);
this.chkDetails.Name = "chkDetails";
this.chkDetails.Size = new System.Drawing.Size(128, 24);
this.chkDetails.TabIndex = 5;
this.chkDetails.Text = "使用默认详细列表";
this.chkDetails.CheckedChanged += new System.EventHandler(this.chkDetails_CheckedChanged);
//
// cboList
//
this.cboList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboList.Enabled = false;
this.cboList.Items.AddRange(new object[] {
"",
"大图标",
"小图标",
"列表"});
this.cboList.Location = new System.Drawing.Point(175, 213);
this.cboList.Name = "cboList";
this.cboList.Size = new System.Drawing.Size(120, 20);
this.cboList.TabIndex = 6;
//
// DinCloumn
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(298, 248);
this.Controls.Add(this.cboList);
this.Controls.Add(this.chkDetails);
this.Controls.Add(this.btnSelectAll);
this.Controls.Add(this.btnRedo);
this.Controls.Add(this.btnDo);
this.Controls.Add(this.chkListBoxColumn);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DinCloumn";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "自定义列";
this.Load += new System.EventHandler(this.DinCloumn_Load);
this.ResumeLayout(false);
}
#endregion
public CheckedListBox ListBoxColumn
{
get{return this.chkListBoxColumn;}
set{this.chkListBoxColumn = value;}
}
public ComboBox CboList
{
get{return this.cboList;}
set{this.cboList = value;}
}
private void DinCloumn_Load(object sender, System.EventArgs e)
{
this.chkListBoxColumn.Items.AddRange(new object[] {
"姓名",
"性别",
"身份证号码",
"民族",
"最高学历",
"籍贯",
"家庭住址",
"固定电话",
"手机",
"爱好",
"特长",
"最近照片",
"备注"});
this.cboList.SelectedIndex = 0;
}
//取消选择
private void btnRedo_Click(object sender, System.EventArgs e)
{
this.chkListBoxColumn.Items.Clear();
DinCloumn_Load(sender,e);
}
//关闭
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
//应用列样式
private void btnDo_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
//全选
private void btnSelectAll_Click(object sender, System.EventArgs e)
{
for(int i=0;i<this.chkListBoxColumn.Items.Count;i++)
{
this.chkListBoxColumn.SetItemChecked(i,true);
}
}
private void chkDetails_CheckedChanged(object sender, System.EventArgs e)
{
this.cboList.Enabled = !this.chkDetails.Checked;
this.chkListBoxColumn.Enabled = this.chkDetails.Checked;
this.chkListBoxColumn.Items.Clear();
DinCloumn_Load(sender,e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -