From 52b72a0c3c8fbbab3bc099b2703b07d468bf384d Mon Sep 17 00:00:00 2001 From: Falcon <12919280+falconfly@user.noreply.gitee.com> Date: Fri, 26 Jul 2024 11:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CalendarNotepad/WorkMain.Designer.cs | 64 ++++++++-- CalendarNotepad/WorkMain.cs | 5 + CalendarNotepad/WorkMain.resx | 111 ---------------- .../dlgDatabaseSchemas.Designer.cs | 57 +++++++++ CalendarNotepad/dlgDatabaseSchemas.cs | 35 +++++ CalendarNotepad/dlgDatabaseSchemas.resx | 120 ++++++++++++++++++ 6 files changed, 270 insertions(+), 122 deletions(-) create mode 100644 CalendarNotepad/dlgDatabaseSchemas.Designer.cs create mode 100644 CalendarNotepad/dlgDatabaseSchemas.cs create mode 100644 CalendarNotepad/dlgDatabaseSchemas.resx diff --git a/CalendarNotepad/WorkMain.Designer.cs b/CalendarNotepad/WorkMain.Designer.cs index 429a894..2f79ef2 100644 --- a/CalendarNotepad/WorkMain.Designer.cs +++ b/CalendarNotepad/WorkMain.Designer.cs @@ -60,19 +60,22 @@ 导入ToolStripMenuItem = new ToolStripMenuItem(); 下载ToolStripMenuItem = new ToolStripMenuItem(); tabPage1 = new TabPage(); + flowLayoutPanel5 = new FlowLayoutPanel(); + bt_m_dbshc = new Button(); + label5 = new Label(); flowLayoutPanel4 = new FlowLayoutPanel(); bt_m_Backup = new Button(); label1 = new Label(); flowLayoutPanel3 = new FlowLayoutPanel(); bt_m_ys = new Button(); label3 = new Label(); + lab_m_dbsize = new Label(); flowLayoutPanel2 = new FlowLayoutPanel(); bt_m_Clean = new Button(); label2 = new Label(); panel2 = new Panel(); panel3 = new Panel(); OpenFileDlg = new OpenFileDialog(); - lab_m_dbsize = new Label(); tabControl1.SuspendLayout(); tpWorkManage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit(); @@ -91,6 +94,7 @@ toolStrip1.SuspendLayout(); cms_FileList.SuspendLayout(); tabPage1.SuspendLayout(); + flowLayoutPanel5.SuspendLayout(); flowLayoutPanel4.SuspendLayout(); flowLayoutPanel3.SuspendLayout(); flowLayoutPanel2.SuspendLayout(); @@ -441,6 +445,7 @@ // // tabPage1 // + tabPage1.Controls.Add(flowLayoutPanel5); tabPage1.Controls.Add(flowLayoutPanel4); tabPage1.Controls.Add(flowLayoutPanel3); tabPage1.Controls.Add(flowLayoutPanel2); @@ -454,6 +459,38 @@ tabPage1.Text = "管理"; tabPage1.UseVisualStyleBackColor = true; // + // flowLayoutPanel5 + // + flowLayoutPanel5.AutoSize = true; + flowLayoutPanel5.Controls.Add(bt_m_dbshc); + flowLayoutPanel5.Controls.Add(label5); + flowLayoutPanel5.Dock = DockStyle.Top; + flowLayoutPanel5.Location = new Point(3,120); + flowLayoutPanel5.Name = "flowLayoutPanel5"; + flowLayoutPanel5.Padding = new Padding(5); + flowLayoutPanel5.Size = new Size(705,39); + flowLayoutPanel5.TabIndex = 6; + // + // bt_m_dbshc + // + bt_m_dbshc.Location = new Point(8,8); + bt_m_dbshc.Name = "bt_m_dbshc"; + bt_m_dbshc.Size = new Size(75,23); + bt_m_dbshc.TabIndex = 0; + bt_m_dbshc.Text = "架构"; + bt_m_dbshc.UseVisualStyleBackColor = true; + bt_m_dbshc.Click += bt_m_dbshc_Click; + // + // label5 + // + label5.AutoSize = true; + label5.Font = new Font("微软雅黑",12F,FontStyle.Regular,GraphicsUnit.Point); + label5.Location = new Point(89,5); + label5.Name = "label5"; + label5.Size = new Size(122,21); + label5.TabIndex = 1; + label5.Text = "查看数据库架构"; + // // flowLayoutPanel4 // flowLayoutPanel4.AutoSize = true; @@ -519,6 +556,16 @@ label3.TabIndex = 1; label3.Text = "压缩数据库文件尺寸,减少文件大小"; // + // lab_m_dbsize + // + lab_m_dbsize.AutoSize = true; + lab_m_dbsize.Font = new Font("微软雅黑",12F,FontStyle.Regular,GraphicsUnit.Point); + lab_m_dbsize.Location = new Point(361,5); + lab_m_dbsize.Name = "lab_m_dbsize"; + lab_m_dbsize.Size = new Size(42,21); + lab_m_dbsize.TabIndex = 2; + lab_m_dbsize.Text = "当前"; + // // flowLayoutPanel2 // flowLayoutPanel2.AutoSize = true; @@ -574,16 +621,6 @@ // OpenFileDlg.Multiselect = true; // - // lab_m_dbsize - // - lab_m_dbsize.AutoSize = true; - lab_m_dbsize.Font = new Font("微软雅黑",12F,FontStyle.Regular,GraphicsUnit.Point); - lab_m_dbsize.Location = new Point(361,5); - lab_m_dbsize.Name = "lab_m_dbsize"; - lab_m_dbsize.Size = new Size(42,21); - lab_m_dbsize.TabIndex = 2; - lab_m_dbsize.Text = "当前"; - // // WorkMain // AutoScaleDimensions = new SizeF(7F,17F); @@ -619,6 +656,8 @@ cms_FileList.ResumeLayout(false); tabPage1.ResumeLayout(false); tabPage1.PerformLayout(); + flowLayoutPanel5.ResumeLayout(false); + flowLayoutPanel5.PerformLayout(); flowLayoutPanel4.ResumeLayout(false); flowLayoutPanel4.PerformLayout(); flowLayoutPanel3.ResumeLayout(false); @@ -676,5 +715,8 @@ private ToolStripSeparator toolStripSeparator1; private ToolStripButton tsb_loadin; private Label lab_m_dbsize; + private FlowLayoutPanel flowLayoutPanel5; + private Button bt_m_dbshc; + private Label label5; } } \ No newline at end of file diff --git a/CalendarNotepad/WorkMain.cs b/CalendarNotepad/WorkMain.cs index af283ea..12a59f4 100644 --- a/CalendarNotepad/WorkMain.cs +++ b/CalendarNotepad/WorkMain.cs @@ -355,5 +355,10 @@ namespace CalendarNotepad private void tsb_loadin_Click(object sender,EventArgs e) { 导入ToolStripMenuItem_Click(sender,EventArgs.Empty); } + + private void bt_m_dbshc_Click(object sender,EventArgs e) { + var dlg = new dlgDatabaseSchemas(); + dlg.Show(); + } } } diff --git a/CalendarNotepad/WorkMain.resx b/CalendarNotepad/WorkMain.resx index 44c8dc7..0290df8 100644 --- a/CalendarNotepad/WorkMain.resx +++ b/CalendarNotepad/WorkMain.resx @@ -117,78 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - 17, 17 - - True - @@ -208,54 +139,12 @@ AAAAAElFTkSuQmCC - - True - 127, 17 - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - 248, 17 - - True - 36 diff --git a/CalendarNotepad/dlgDatabaseSchemas.Designer.cs b/CalendarNotepad/dlgDatabaseSchemas.Designer.cs new file mode 100644 index 0000000..2f3ea9e --- /dev/null +++ b/CalendarNotepad/dlgDatabaseSchemas.Designer.cs @@ -0,0 +1,57 @@ +namespace CalendarNotepad +{ + partial class dlgDatabaseSchemas + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + richTextBox1 = new RichTextBox(); + SuspendLayout(); + // + // richTextBox1 + // + richTextBox1.Dock = DockStyle.Fill; + richTextBox1.Location = new Point(0,0); + richTextBox1.Name = "richTextBox1"; + richTextBox1.Size = new Size(432,281); + richTextBox1.TabIndex = 0; + richTextBox1.Text = ""; + // + // dlgDatabaseSchemas + // + AutoScaleDimensions = new SizeF(7F,17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(432,281); + Controls.Add(richTextBox1); + Name = "dlgDatabaseSchemas"; + StartPosition = FormStartPosition.CenterParent; + Text = "数据库架构文本"; + Load += dlgDatabaseSchemas_Load; + ResumeLayout(false); + } + + #endregion + + private RichTextBox richTextBox1; + } +} \ No newline at end of file diff --git a/CalendarNotepad/dlgDatabaseSchemas.cs b/CalendarNotepad/dlgDatabaseSchemas.cs new file mode 100644 index 0000000..565c2af --- /dev/null +++ b/CalendarNotepad/dlgDatabaseSchemas.cs @@ -0,0 +1,35 @@ +using CalendarNotepad.Extends; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CalendarNotepad +{ + public partial class dlgDatabaseSchemas:Form + { + public dlgDatabaseSchemas() { + InitializeComponent(); + } + + private void dlgDatabaseSchemas_Load(object sender,EventArgs e) { + StringBuilder sb = new(); + using var db = new DbContext(); + var tables = db.DbMaintenance.GetTableInfoList(false); + sb.AppendLine($"查询共{tables.Count}张表"); + foreach(var t in tables) { + sb.AppendLine($"Table:{t.Name}"); + var cols = db.DbMaintenance.GetColumnInfosByTableName(t.Name,false); + foreach(var c in cols) { + sb.AppendLine($" Column:{c.DbColumnName}:{c.DataType}:{c.Length}:{c.ColumnDescription}"); + } + } + this.richTextBox1.Text = sb.ToString(); + } + } +} diff --git a/CalendarNotepad/dlgDatabaseSchemas.resx b/CalendarNotepad/dlgDatabaseSchemas.resx new file mode 100644 index 0000000..a395bff --- /dev/null +++ b/CalendarNotepad/dlgDatabaseSchemas.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file