diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index aa359bd9..b3797d4e 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Forms/UIDataGridViewForm.Designer.cs b/SunnyUI/Forms/UIDataGridViewForm.Designer.cs new file mode 100644 index 00000000..62446aa6 --- /dev/null +++ b/SunnyUI/Forms/UIDataGridViewForm.Designer.cs @@ -0,0 +1,178 @@ +namespace Sunny.UI +{ + partial class UIDataGridViewForm + { + /// + /// 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() + { + 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; + } +} \ No newline at end of file diff --git a/SunnyUI/Forms/UIDataGridViewForm.cs b/SunnyUI/Forms/UIDataGridViewForm.cs new file mode 100644 index 00000000..e59d79b2 --- /dev/null +++ b/SunnyUI/Forms/UIDataGridViewForm.cs @@ -0,0 +1,10 @@ +namespace Sunny.UI +{ + public partial class UIDataGridViewForm : UITitlePage + { + public UIDataGridViewForm() + { + InitializeComponent(); + } + } +} diff --git a/SunnyUI/Static/USystem.cs b/SunnyUI/Static/USystem.cs index 3219c4ab..e103054d 100644 --- a/SunnyUI/Static/USystem.cs +++ b/SunnyUI/Static/USystem.cs @@ -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(); + } + + /// + /// txtOutput.ThreadSafeCall(() => txtOutput.Text = "Updated"); + /// + /// + /// + public static void ThreadSafeCall(this Control control, Action method) + { + if (control.InvokeRequired) + { + control.Invoke(method); + } + else + { + method(); + } + } + + public static T ThreadSafeCall(this Control control, Func method) + { + if (control.InvokeRequired) + { + return (T)control.Invoke(method); + } + else + { + return method(); + } + } + /// /// 获取鼠标位置 /// diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index 5950f25c..7864a0b1 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -154,6 +154,12 @@ Component + + Form + + + UIDataGridViewForm.cs + Form