+ UIDataGridViewForm:增加了一个表格模板基类

This commit is contained in:
Sunny 2020-11-03 20:30:36 +08:00
parent 2b84cafe04
commit f488a1f6a6
5 changed files with 242 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,178 @@
namespace Sunny.UI
{
partial class UIDataGridViewForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.Grid = new Sunny.UI.UIDataGridView();
this.Panel = new Sunny.UI.UIPanel();
this.uiSymbolButton4 = new Sunny.UI.UISymbolButton();
this.uiSymbolButton3 = new Sunny.UI.UISymbolButton();
this.uiSymbolButton2 = new Sunny.UI.UISymbolButton();
this.uiSymbolButton1 = new Sunny.UI.UISymbolButton();
this.PagePanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Grid)).BeginInit();
this.Panel.SuspendLayout();
this.SuspendLayout();
//
// PagePanel
//
this.PagePanel.Controls.Add(this.Grid);
this.PagePanel.Controls.Add(this.Panel);
//
// Grid
//
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.Grid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.Grid.BackgroundColor = System.Drawing.Color.White;
this.Grid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Grid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.Grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F);
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255)))));
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.Grid.DefaultCellStyle = dataGridViewCellStyle3;
this.Grid.Dock = System.Windows.Forms.DockStyle.Fill;
this.Grid.EnableHeadersVisualStyles = false;
this.Grid.Font = new System.Drawing.Font("微软雅黑", 12F);
this.Grid.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.Grid.Location = new System.Drawing.Point(0, 0);
this.Grid.Name = "Grid";
dataGridViewCellStyle4.BackColor = System.Drawing.Color.White;
this.Grid.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.Grid.RowTemplate.Height = 29;
this.Grid.SelectedIndex = -1;
this.Grid.ShowGridLine = true;
this.Grid.Size = new System.Drawing.Size(800, 360);
this.Grid.TabIndex = 0;
//
// Panel
//
this.Panel.Controls.Add(this.uiSymbolButton4);
this.Panel.Controls.Add(this.uiSymbolButton3);
this.Panel.Controls.Add(this.uiSymbolButton2);
this.Panel.Controls.Add(this.uiSymbolButton1);
this.Panel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.Panel.Font = new System.Drawing.Font("微软雅黑", 12F);
this.Panel.Location = new System.Drawing.Point(0, 360);
this.Panel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Panel.MinimumSize = new System.Drawing.Size(1, 1);
this.Panel.Name = "Panel";
this.Panel.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.Panel.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)(((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
this.Panel.Size = new System.Drawing.Size(800, 55);
this.Panel.TabIndex = 1;
this.Panel.Text = null;
//
// uiSymbolButton4
//
this.uiSymbolButton4.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiSymbolButton4.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiSymbolButton4.Location = new System.Drawing.Point(345, 10);
this.uiSymbolButton4.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolButton4.Name = "uiSymbolButton4";
this.uiSymbolButton4.Size = new System.Drawing.Size(100, 35);
this.uiSymbolButton4.Symbol = 61639;
this.uiSymbolButton4.TabIndex = 3;
this.uiSymbolButton4.Text = "导出";
this.uiSymbolButton4.Visible = false;
//
// uiSymbolButton3
//
this.uiSymbolButton3.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiSymbolButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiSymbolButton3.Location = new System.Drawing.Point(235, 10);
this.uiSymbolButton3.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolButton3.Name = "uiSymbolButton3";
this.uiSymbolButton3.Size = new System.Drawing.Size(100, 35);
this.uiSymbolButton3.Symbol = 61544;
this.uiSymbolButton3.TabIndex = 2;
this.uiSymbolButton3.Text = "删除";
//
// uiSymbolButton2
//
this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiSymbolButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiSymbolButton2.Location = new System.Drawing.Point(125, 10);
this.uiSymbolButton2.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolButton2.Name = "uiSymbolButton2";
this.uiSymbolButton2.Size = new System.Drawing.Size(100, 35);
this.uiSymbolButton2.Symbol = 61508;
this.uiSymbolButton2.TabIndex = 1;
this.uiSymbolButton2.Text = "编辑";
//
// uiSymbolButton1
//
this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiSymbolButton1.Location = new System.Drawing.Point(15, 10);
this.uiSymbolButton1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolButton1.Name = "uiSymbolButton1";
this.uiSymbolButton1.Size = new System.Drawing.Size(100, 35);
this.uiSymbolButton1.Symbol = 61543;
this.uiSymbolButton1.TabIndex = 0;
this.uiSymbolButton1.Text = "增加";
//
// UIDataGridViewForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Name = "UIDataGridViewForm";
this.Text = "FDataGridView";
this.PagePanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Grid)).EndInit();
this.Panel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
protected UIDataGridView Grid;
protected UIPanel Panel;
protected UISymbolButton uiSymbolButton4;
protected UISymbolButton uiSymbolButton3;
protected UISymbolButton uiSymbolButton2;
protected UISymbolButton uiSymbolButton1;
}
}

View File

@ -0,0 +1,10 @@
namespace Sunny.UI
{
public partial class UIDataGridViewForm : UITitlePage
{
public UIDataGridViewForm()
{
InitializeComponent();
}
}
}

View File

@ -19,6 +19,7 @@
* 2020-01-01: V2.2.0
******************************************************************************/
using Microsoft.Win32;
using Sunny.UI.Win32;
using System;
using System.Diagnostics;
@ -48,6 +49,53 @@ namespace Sunny.UI
return new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
}
public static void EnabledTaskManager()
{
DisableTaskMgrRegistryKey(true);
}
public static void DisabledTaskManager()
{
DisableTaskMgrRegistryKey(false);
}
private static void DisableTaskMgrRegistryKey(bool enabled)
{
string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";
RegistryKey mKey = Registry.CurrentUser.CreateSubKey(subKey);
mKey?.SetValue("DisableTaskMgr", enabled ? 0 : 1);
mKey?.Dispose();
}
/// <summary>
/// txtOutput.ThreadSafeCall(() => txtOutput.Text = "Updated");
/// </summary>
/// <param name="control"></param>
/// <param name="method"></param>
public static void ThreadSafeCall(this Control control, Action method)
{
if (control.InvokeRequired)
{
control.Invoke(method);
}
else
{
method();
}
}
public static T ThreadSafeCall<T>(this Control control, Func<T> method)
{
if (control.InvokeRequired)
{
return (T)control.Invoke(method);
}
else
{
return method();
}
}
/// <summary>
/// 获取鼠标位置
/// </summary>

View File

@ -154,6 +154,12 @@
<Compile Include="Controls\UIWaitingBar.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\UIDataGridViewForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\UIDataGridViewForm.Designer.cs">
<DependentUpon>UIDataGridViewForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\UIFormService.cs" />
<Compile Include="Forms\UILoginForm.cs">
<SubType>Form</SubType>