📄 expendinfotexteditorform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Yinde.Cnc.PageLister
{
/// <summary>
/// 扩展信息文本编辑器。
/// </summary>
public class ExpendInfoTextEditorForm : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtExpendInfoText;
private System.Windows.Forms.Button btnAccept;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.ListBox lstItem;
private System.Windows.Forms.Label lblView;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
/// <summary>
/// 扩展信息文本编辑器。
/// </summary>
public ExpendInfoTextEditorForm()
{
//
// 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()
{
this.txtExpendInfoText = new System.Windows.Forms.TextBox();
this.btnAccept = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.lblView = new System.Windows.Forms.Label();
this.lstItem = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// txtExpendInfoText
//
this.txtExpendInfoText.Location = new System.Drawing.Point(16, 8);
this.txtExpendInfoText.Name = "txtExpendInfoText";
this.txtExpendInfoText.Size = new System.Drawing.Size(376, 21);
this.txtExpendInfoText.TabIndex = 0;
this.txtExpendInfoText.Text = "";
this.txtExpendInfoText.TextChanged += new System.EventHandler(this.txtExpendInfoText_TextChanged);
//
// btnAccept
//
this.btnAccept.Location = new System.Drawing.Point(312, 120);
this.btnAccept.Name = "btnAccept";
this.btnAccept.TabIndex = 1;
this.btnAccept.Text = "确定";
this.btnAccept.Click += new System.EventHandler(this.btnAccept_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(312, 88);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "取消";
//
// lblView
//
this.lblView.Location = new System.Drawing.Point(16, 40);
this.lblView.Name = "lblView";
this.lblView.Size = new System.Drawing.Size(376, 16);
this.lblView.TabIndex = 3;
//
// lstItem
//
this.lstItem.ItemHeight = 12;
this.lstItem.Items.AddRange(new object[] {
"页索引 \t\tPageIndex",
"起始记录索引\tRecordStartIndex",
"结束记录索引\tRecordEndIndex",
"记录集总页数\tPageCount",
"记录集总数\tRecordCount",
"单页显示记录数\tPageSize"});
this.lstItem.Location = new System.Drawing.Point(16, 72);
this.lstItem.Name = "lstItem";
this.lstItem.Size = new System.Drawing.Size(280, 76);
this.lstItem.TabIndex = 4;
this.lstItem.DoubleClick += new System.EventHandler(this.lstItem_DoubleClick);
//
// ExpendInfoTextEditorForm
//
this.AcceptButton = this.btnAccept;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(402, 159);
this.Controls.Add(this.lstItem);
this.Controls.Add(this.lblView);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnAccept);
this.Controls.Add(this.txtExpendInfoText);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExpendInfoTextEditorForm";
this.Text = "扩展信息文本编辑器";
this.ResumeLayout(false);
}
#endregion
private void txtExpendInfoText_TextChanged(object sender, System.EventArgs e)
{
try
{
lblView.Text=String.Format(this.txtExpendInfoText.Text,"2","11","20","23","225","10");
}
catch
{
lblView.Text="格式有误,无法转换";
}
}
private void lstItem_DoubleClick(object sender, System.EventArgs e)
{
txtExpendInfoText.Text+= "{" + lstItem.SelectedIndex + "}";
txtExpendInfoText.Focus();
txtExpendInfoText.SelectionStart=txtExpendInfoText.Text.Length;
}
private void btnAccept_Click(object sender, System.EventArgs e)
{
if(lblView.Text!="格式有误,无法转换")
{
DialogResult=DialogResult.OK;
Close();
}
}
/// <summary>
/// 设置或获得 ExpendInfoText 属性值
/// </summary>
public string Value
{
get
{
return txtExpendInfoText.Text;
}
set
{
txtExpendInfoText.Text=value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -