📄 frmoptimizedetail.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace DS.EMIS.StartPrepare
{
/// <summary>
/// FrmOptimizeDetail 的摘要说明。
/// </summary>
public class FrmOptimizeDetail : System.Windows.Forms.Form
{
private string fileName = string.Empty;
OptimizeManager optManager = new OptimizeManager();
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RichTextBox txtSqlContent;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnClose;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FrmOptimizeDetail()
{
//
// 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.panel1 = new System.Windows.Forms.Panel();
this.btnClose = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtSqlContent = new System.Windows.Forms.RichTextBox();
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.btnClose);
this.panel1.Controls.Add(this.btnSave);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 390);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(472, 40);
this.panel1.TabIndex = 0;
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(264, 8);
this.btnClose.Name = "btnClose";
this.btnClose.TabIndex = 1;
this.btnClose.Text = "关闭";
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(120, 8);
this.btnSave.Name = "btnSave";
this.btnSave.TabIndex = 0;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtSqlContent);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(472, 390);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "优化脚本";
//
// txtSqlContent
//
this.txtSqlContent.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtSqlContent.Location = new System.Drawing.Point(3, 17);
this.txtSqlContent.Name = "txtSqlContent";
this.txtSqlContent.Size = new System.Drawing.Size(466, 370);
this.txtSqlContent.TabIndex = 0;
this.txtSqlContent.Text = "richTextBox1";
//
// FrmOptimizeDetail
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(472, 430);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.panel1);
this.Name = "FrmOptimizeDetail";
this.Text = "优化脚本详细信息";
this.Load += new System.EventHandler(this.FrmOptimizeDetail_Load);
this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void Populate()
{
this.txtSqlContent.Text = optManager.ReadSQLScript(this.FileName);
this.Text = this.FileName;
}
private void btnSave_Click(object sender, System.EventArgs e)
{
try
{
optManager.WriteSQLScript(this.fileName,this.txtSqlContent.Text);
MessageBox.Show("保存成功!");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"保存失败",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private void btnClose_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void FrmOptimizeDetail_Load(object sender, System.EventArgs e)
{
Populate();
}
public string FileName
{
set
{
this.fileName = value;
}
get
{
return this.fileName;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -