⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.cs

📁 在C#中直接打开Word文件并编辑
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WordInDOTNET
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class frmMain : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button button1;
		private WinWordControl.WinWordControl objWinWordControl;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtClientName;
		private System.Windows.Forms.TextBox txtRecNo;
		private System.Windows.Forms.Button btnClientName;
		private System.Windows.Forms.Button btnRecNo;
		private System.Windows.Forms.Button btnCurrentDate;
		private System.Windows.Forms.Button btnMarkError;
		private System.Windows.Forms.Button btnRemoveError;
		private System.Windows.Forms.Button btnSaveDocument;
		private System.Windows.Forms.Button btnRemoveBookMarks;
		private System.Windows.Forms.Button btnPrintView;
		private System.Windows.Forms.Button btnNormalView;
		private System.Windows.Forms.Button btnWebView;
		private System.Windows.Forms.Button btnShowMenuBar;
		private System.Windows.Forms.OpenFileDialog openFileDialog1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmMain()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.button1 = new System.Windows.Forms.Button();
			this.objWinWordControl = new WinWordControl.WinWordControl();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.txtClientName = new System.Windows.Forms.TextBox();
			this.txtRecNo = new System.Windows.Forms.TextBox();
			this.btnClientName = new System.Windows.Forms.Button();
			this.btnRecNo = new System.Windows.Forms.Button();
			this.btnCurrentDate = new System.Windows.Forms.Button();
			this.btnMarkError = new System.Windows.Forms.Button();
			this.btnRemoveError = new System.Windows.Forms.Button();
			this.btnSaveDocument = new System.Windows.Forms.Button();
			this.btnRemoveBookMarks = new System.Windows.Forms.Button();
			this.btnPrintView = new System.Windows.Forms.Button();
			this.btnNormalView = new System.Windows.Forms.Button();
			this.btnWebView = new System.Windows.Forms.Button();
			this.btnShowMenuBar = new System.Windows.Forms.Button();
			this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(16, 8);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(96, 23);
			this.button1.TabIndex = 1;
			this.button1.Text = "Load Document";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// objWinWordControl
			// 
			this.objWinWordControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.objWinWordControl.BackColor = System.Drawing.SystemColors.ActiveCaption;
			this.objWinWordControl.Location = new System.Drawing.Point(168, 0);
			this.objWinWordControl.Name = "objWinWordControl";
			this.objWinWordControl.Size = new System.Drawing.Size(544, 517);
			this.objWinWordControl.TabIndex = 3;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 48);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 16);
			this.label1.TabIndex = 4;
			this.label1.Text = "Client\'s Name";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 104);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(88, 16);
			this.label2.TabIndex = 5;
			this.label2.Text = "Record Number";
			// 
			// txtClientName
			// 
			this.txtClientName.Location = new System.Drawing.Point(16, 64);
			this.txtClientName.Name = "txtClientName";
			this.txtClientName.TabIndex = 6;
			this.txtClientName.Text = "Some Name";
			// 
			// txtRecNo
			// 
			this.txtRecNo.Location = new System.Drawing.Point(16, 120);
			this.txtRecNo.Name = "txtRecNo";
			this.txtRecNo.TabIndex = 7;
			this.txtRecNo.Text = "456789123";
			// 
			// btnClientName
			// 
			this.btnClientName.Location = new System.Drawing.Point(120, 64);
			this.btnClientName.Name = "btnClientName";
			this.btnClientName.Size = new System.Drawing.Size(32, 16);
			this.btnClientName.TabIndex = 9;
			this.btnClientName.Text = "-->";
			this.btnClientName.Click += new System.EventHandler(this.btnClientName_Click);
			// 
			// btnRecNo
			// 
			this.btnRecNo.Location = new System.Drawing.Point(120, 120);
			this.btnRecNo.Name = "btnRecNo";
			this.btnRecNo.Size = new System.Drawing.Size(32, 16);
			this.btnRecNo.TabIndex = 10;
			this.btnRecNo.Text = "-->";
			this.btnRecNo.Click += new System.EventHandler(this.btnRecNo_Click);
			// 
			// btnCurrentDate
			// 
			this.btnCurrentDate.Location = new System.Drawing.Point(8, 160);
			this.btnCurrentDate.Name = "btnCurrentDate";
			this.btnCurrentDate.Size = new System.Drawing.Size(128, 24);
			this.btnCurrentDate.TabIndex = 11;
			this.btnCurrentDate.Text = "Insert Current Date";
			this.btnCurrentDate.Click += new System.EventHandler(this.btnCurrentDate_Click);
			// 
			// btnMarkError
			// 
			this.btnMarkError.Location = new System.Drawing.Point(32, 200);
			this.btnMarkError.Name = "btnMarkError";
			this.btnMarkError.TabIndex = 12;
			this.btnMarkError.Text = "Mark Error";
			this.btnMarkError.Click += new System.EventHandler(this.btnMarkError_Click);
			// 
			// btnRemoveError
			// 
			this.btnRemoveError.Location = new System.Drawing.Point(8, 240);
			this.btnRemoveError.Name = "btnRemoveError";
			this.btnRemoveError.Size = new System.Drawing.Size(152, 23);
			this.btnRemoveError.TabIndex = 15;
			this.btnRemoveError.Text = "Remove Error Highlighting";
			this.btnRemoveError.Click += new System.EventHandler(this.btnRemoveError_Click);
			// 
			// btnSaveDocument
			// 
			this.btnSaveDocument.Location = new System.Drawing.Point(24, 320);
			this.btnSaveDocument.Name = "btnSaveDocument";
			this.btnSaveDocument.Size = new System.Drawing.Size(112, 23);
			this.btnSaveDocument.TabIndex = 16;
			this.btnSaveDocument.Text = "Save Document";
			this.btnSaveDocument.Click += new System.EventHandler(this.btnSaveDocument_Click);
			// 
			// btnRemoveBookMarks
			// 
			this.btnRemoveBookMarks.Location = new System.Drawing.Point(8, 280);
			this.btnRemoveBookMarks.Name = "btnRemoveBookMarks";
			this.btnRemoveBookMarks.Size = new System.Drawing.Size(152, 23);
			this.btnRemoveBookMarks.TabIndex = 17;
			this.btnRemoveBookMarks.Text = "Remove bookmarks";
			this.btnRemoveBookMarks.Click += new System.EventHandler(this.btnRemoveBookMarks_Click);
			// 
			// btnPrintView
			// 
			this.btnPrintView.Location = new System.Drawing.Point(24, 368);
			this.btnPrintView.Name = "btnPrintView";
			this.btnPrintView.Size = new System.Drawing.Size(120, 23);
			this.btnPrintView.TabIndex = 18;
			this.btnPrintView.Text = "Print Layout View";
			this.btnPrintView.Click += new System.EventHandler(this.btnPrintView_Click);
			// 
			// btnNormalView
			// 
			this.btnNormalView.Location = new System.Drawing.Point(24, 400);
			this.btnNormalView.Name = "btnNormalView";
			this.btnNormalView.Size = new System.Drawing.Size(120, 23);
			this.btnNormalView.TabIndex = 19;
			this.btnNormalView.Text = "Normal View";
			this.btnNormalView.Click += new System.EventHandler(this.btnNormalView_Click);
			// 
			// btnWebView
			// 
			this.btnWebView.Location = new System.Drawing.Point(24, 432);
			this.btnWebView.Name = "btnWebView";
			this.btnWebView.Size = new System.Drawing.Size(120, 23);
			this.btnWebView.TabIndex = 20;
			this.btnWebView.Text = "Web View";
			this.btnWebView.Click += new System.EventHandler(this.btnWebView_Click);
			// 
			// btnShowMenuBar
			// 
			this.btnShowMenuBar.Location = new System.Drawing.Point(16, 472);
			this.btnShowMenuBar.Name = "btnShowMenuBar";
			this.btnShowMenuBar.Size = new System.Drawing.Size(136, 23);
			this.btnShowMenuBar.TabIndex = 21;
			this.btnShowMenuBar.Text = "Show MenuBar";
			this.btnShowMenuBar.Click += new System.EventHandler(this.btnShowMenuBar_Click);
			// 
			// frmMain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(712, 517);
			this.Controls.Add(this.btnShowMenuBar);
			this.Controls.Add(this.btnWebView);
			this.Controls.Add(this.btnNormalView);
			this.Controls.Add(this.btnPrintView);
			this.Controls.Add(this.btnRemoveBookMarks);
			this.Controls.Add(this.btnSaveDocument);
			this.Controls.Add(this.btnRemoveError);
			this.Controls.Add(this.btnMarkError);
			this.Controls.Add(this.btnCurrentDate);
			this.Controls.Add(this.btnRecNo);
			this.Controls.Add(this.btnClientName);
			this.Controls.Add(this.txtRecNo);
			this.Controls.Add(this.txtClientName);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.objWinWordControl);
			this.Controls.Add(this.button1);
			this.Name = "frmMain";
			this.Text = "Main";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.frmMain_Closing);
			this.Load += new System.EventHandler(this.frmMain_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new frmMain());
		}

		private void frmMain_Load(object sender, System.EventArgs e)
		{
		}

		/// <summary>
		/// Loads the document. If it is already loaded, it will first unload and load again.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button1_Click(object sender, System.EventArgs e)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -