1、优化LOG显示与引用

2、添加PMA工具,工具内容待完善
3、修复流程树显示
4、添加开源项目,优化UI空间
5、其他BUG更改
This commit is contained in:
liu.wenjie
2021-11-23 15:51:37 +08:00
parent 47f77f5e64
commit a24dda2525
474 changed files with 91916 additions and 6429 deletions

View File

@@ -0,0 +1,41 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="DateTimePickerType.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// Enum DateTimePickerType
/// </summary>
public enum DateTimePickerType
{
/// <summary>
/// The date time
/// </summary>
DateTime = 1,
/// <summary>
/// The date
/// </summary>
Date = 2,
/// <summary>
/// The time
/// </summary>
Time = 4
}
}

View File

@@ -0,0 +1,384 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCDatePickerExt.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCDatePickerExt.
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
partial class UCDatePickerExt
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.label5 = new System.Windows.Forms.Label();
this.txtMinute = new HZH_Controls.Controls.TextBoxEx();
this.label4 = new System.Windows.Forms.Label();
this.txtHour = new HZH_Controls.Controls.TextBoxEx();
this.label3 = new System.Windows.Forms.Label();
this.txtDay = new HZH_Controls.Controls.TextBoxEx();
this.label2 = new System.Windows.Forms.Label();
this.txtMonth = new HZH_Controls.Controls.TextBoxEx();
this.label1 = new System.Windows.Forms.Label();
this.txtYear = new HZH_Controls.Controls.TextBoxEx();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.txtMinute);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.txtHour);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.txtDay);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.txtMonth);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.txtYear);
this.panel1.Location = new System.Drawing.Point(3, 6);
this.panel1.MaximumSize = new System.Drawing.Size(0, 27);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(330, 27);
this.panel1.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Dock = System.Windows.Forms.DockStyle.Left;
this.label5.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.label5.Location = new System.Drawing.Point(301, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 27);
this.label5.TabIndex = 17;
this.label5.Text = "分";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtMinute
//
this.txtMinute.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtMinute.DecLength = 2;
this.txtMinute.Dock = System.Windows.Forms.DockStyle.Left;
this.txtMinute.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtMinute.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.txtMinute.InputType = HZH_Controls.TextInputType.Integer;
this.txtMinute.Location = new System.Drawing.Point(272, 0);
this.txtMinute.MaxValue = new decimal(new int[] {
59,
0,
0,
0});
this.txtMinute.MinValue = new decimal(new int[] {
0,
0,
0,
0});
this.txtMinute.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
this.txtMinute.Name = "txtMinute";
this.txtMinute.OldText = null;
this.txtMinute.PromptColor = System.Drawing.Color.Gray;
this.txtMinute.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtMinute.PromptText = "";
this.txtMinute.RegexPattern = "";
this.txtMinute.Size = new System.Drawing.Size(29, 27);
this.txtMinute.TabIndex = 5;
this.txtMinute.Text = "59";
this.txtMinute.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtMinute.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
this.txtMinute.Leave += new System.EventHandler(this.txtMinute_Leave);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Dock = System.Windows.Forms.DockStyle.Left;
this.label4.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.label4.Location = new System.Drawing.Point(240, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 27);
this.label4.TabIndex = 16;
this.label4.Text = "时";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtHour
//
this.txtHour.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtHour.DecLength = 2;
this.txtHour.Dock = System.Windows.Forms.DockStyle.Left;
this.txtHour.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtHour.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.txtHour.InputType = HZH_Controls.TextInputType.Integer;
this.txtHour.Location = new System.Drawing.Point(211, 0);
this.txtHour.MaxValue = new decimal(new int[] {
23,
0,
0,
0});
this.txtHour.MinValue = new decimal(new int[] {
0,
0,
0,
0});
this.txtHour.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
this.txtHour.Name = "txtHour";
this.txtHour.OldText = null;
this.txtHour.PromptColor = System.Drawing.Color.Gray;
this.txtHour.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtHour.PromptText = "";
this.txtHour.RegexPattern = "";
this.txtHour.Size = new System.Drawing.Size(29, 27);
this.txtHour.TabIndex = 4;
this.txtHour.Text = "23";
this.txtHour.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtHour.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
this.txtHour.TextChanged += new System.EventHandler(this.txtHour_TextChanged);
this.txtHour.Leave += new System.EventHandler(this.txtHour_Leave);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Dock = System.Windows.Forms.DockStyle.Left;
this.label3.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.label3.Location = new System.Drawing.Point(173, 0);
this.label3.Margin = new System.Windows.Forms.Padding(0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 27);
this.label3.TabIndex = 14;
this.label3.Text = " 日";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtDay
//
this.txtDay.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtDay.DecLength = 2;
this.txtDay.Dock = System.Windows.Forms.DockStyle.Left;
this.txtDay.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtDay.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.txtDay.InputType = HZH_Controls.TextInputType.Integer;
this.txtDay.Location = new System.Drawing.Point(144, 0);
this.txtDay.MaxValue = new decimal(new int[] {
31,
0,
0,
0});
this.txtDay.MinValue = new decimal(new int[] {
0,
0,
0,
0});
this.txtDay.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
this.txtDay.Name = "txtDay";
this.txtDay.OldText = null;
this.txtDay.PromptColor = System.Drawing.Color.Gray;
this.txtDay.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtDay.PromptText = "";
this.txtDay.RegexPattern = "";
this.txtDay.Size = new System.Drawing.Size(29, 27);
this.txtDay.TabIndex = 3;
this.txtDay.Text = "12";
this.txtDay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtDay.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
this.txtDay.TextChanged += new System.EventHandler(this.txtDay_TextChanged);
this.txtDay.Leave += new System.EventHandler(this.txtDay_Leave);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Dock = System.Windows.Forms.DockStyle.Left;
this.label2.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.label2.Location = new System.Drawing.Point(112, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 27);
this.label2.TabIndex = 12;
this.label2.Text = "月";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtMonth
//
this.txtMonth.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtMonth.DecLength = 2;
this.txtMonth.Dock = System.Windows.Forms.DockStyle.Left;
this.txtMonth.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtMonth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.txtMonth.InputType = HZH_Controls.TextInputType.Integer;
this.txtMonth.Location = new System.Drawing.Point(83, 0);
this.txtMonth.MaxValue = new decimal(new int[] {
12,
0,
0,
0});
this.txtMonth.MinValue = new decimal(new int[] {
0,
0,
0,
0});
this.txtMonth.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
this.txtMonth.Name = "txtMonth";
this.txtMonth.OldText = null;
this.txtMonth.PromptColor = System.Drawing.Color.Gray;
this.txtMonth.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtMonth.PromptText = "";
this.txtMonth.RegexPattern = "";
this.txtMonth.Size = new System.Drawing.Size(29, 27);
this.txtMonth.TabIndex = 2;
this.txtMonth.Text = "12";
this.txtMonth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtMonth.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
this.txtMonth.TextChanged += new System.EventHandler(this.txtMonth_TextChanged);
this.txtMonth.Leave += new System.EventHandler(this.txtMonth_Leave);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
this.label1.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.label1.Location = new System.Drawing.Point(51, 0);
this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 27);
this.label1.TabIndex = 10;
this.label1.Text = "年";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtYear
//
this.txtYear.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtYear.DecLength = 2;
this.txtYear.Dock = System.Windows.Forms.DockStyle.Left;
this.txtYear.Font = new System.Drawing.Font("Arial Unicode MS", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtYear.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.txtYear.InputType = HZH_Controls.TextInputType.Integer;
this.txtYear.Location = new System.Drawing.Point(0, 0);
this.txtYear.MaxValue = new decimal(new int[] {
2099,
0,
0,
0});
this.txtYear.MinValue = new decimal(new int[] {
0,
0,
0,
0});
this.txtYear.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
this.txtYear.Name = "txtYear";
this.txtYear.OldText = null;
this.txtYear.PromptColor = System.Drawing.Color.Gray;
this.txtYear.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.txtYear.PromptText = "";
this.txtYear.RegexPattern = "";
this.txtYear.Size = new System.Drawing.Size(51, 27);
this.txtYear.TabIndex = 1;
this.txtYear.Text = "2019";
this.txtYear.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtYear.SizeChanged += new System.EventHandler(this.txt_SizeChanged);
this.txtYear.TextChanged += new System.EventHandler(this.txtYear_TextChanged);
this.txtYear.Leave += new System.EventHandler(this.txtYear_Leave);
//
// UCDatePickerExt
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ConerRadius = 5;
this.Controls.Add(this.panel1);
this.IsRadius = true;
this.IsShowRect = true;
this.Name = "UCDatePickerExt";
this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
this.Size = new System.Drawing.Size(336, 39);
this.Load += new System.EventHandler(this.UCDatePickerExt_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The panel1
/// </summary>
private System.Windows.Forms.Panel panel1;
/// <summary>
/// The label4
/// </summary>
private System.Windows.Forms.Label label4;
/// <summary>
/// The label3
/// </summary>
private System.Windows.Forms.Label label3;
/// <summary>
/// The label2
/// </summary>
private System.Windows.Forms.Label label2;
/// <summary>
/// The label1
/// </summary>
private System.Windows.Forms.Label label1;
/// <summary>
/// The text minute
/// </summary>
private TextBoxEx txtMinute;
/// <summary>
/// The text hour
/// </summary>
private TextBoxEx txtHour;
/// <summary>
/// The text day
/// </summary>
private TextBoxEx txtDay;
/// <summary>
/// The text month
/// </summary>
private TextBoxEx txtMonth;
/// <summary>
/// The text year
/// </summary>
private TextBoxEx txtYear;
/// <summary>
/// The label5
/// </summary>
private System.Windows.Forms.Label label5;
}
}

View File

@@ -0,0 +1,369 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCDatePickerExt.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCDatePickerExt.
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
public partial class UCDatePickerExt : UCControlBase
{
/// <summary>
/// The m FRM anchor
/// </summary>
Forms.FrmAnchor m_frmAnchor;
/// <summary>
/// The m select pan
/// </summary>
UCDateTimeSelectPan m_selectPan = null;
/// <summary>
/// The m type
/// </summary>
DateTimePickerType m_type = DateTimePickerType.DateTime;
/// <summary>
/// Gets or sets the type of the time.
/// </summary>
/// <value>The type of the time.</value>
[Description("时间类型"), Category("自定义")]
public DateTimePickerType TimeType
{
get { return m_type; }
set
{
m_type = value;
if (value == DateTimePickerType.DateTime)
{
txtYear.Visible = true;
label1.Visible = true;
txtMonth.Visible = true;
label2.Visible = true;
txtDay.Visible = true;
label3.Visible = true;
txtHour.Visible = true;
label4.Visible = true;
txtMinute.Visible = true;
label5.Visible = true;
}
else if (value == DateTimePickerType.Date)
{
txtYear.Visible = true;
label1.Visible = true;
txtMonth.Visible = true;
label2.Visible = true;
txtDay.Visible = true;
label3.Visible = true;
txtHour.Visible = false;
label4.Visible = false;
txtMinute.Visible = false;
label5.Visible = false;
}
else
{
txtYear.Visible = false;
label1.Visible = false;
txtMonth.Visible = false;
label2.Visible = false;
txtDay.Visible = false;
label3.Visible = false;
txtHour.Visible = true;
label4.Visible = true;
txtMinute.Visible = true;
label5.Visible = true;
}
}
}
/// <summary>
/// The current time
/// </summary>
private DateTime currentTime = DateTime.Now;
/// <summary>
/// The time font size
/// </summary>
private int timeFontSize = 20;
/// <summary>
/// Gets or sets the size of the time font.
/// </summary>
/// <value>The size of the time font.</value>
[Description("时间字体大小"), Category("自定义")]
public int TimeFontSize
{
get { return timeFontSize; }
set
{
if (timeFontSize != value)
{
timeFontSize = value;
foreach (Control c in panel1.Controls)
{
c.Font = new Font(c.Font.Name, value);
}
}
}
}
/// <summary>
/// Gets or sets the current time.
/// </summary>
/// <value>The current time.</value>
[Description("时间"), Category("自定义")]
public DateTime CurrentTime
{
get { return currentTime; }
set
{
currentTime = value;
SetTimeToControl();
}
}
/// <summary>
/// Sets the time to control.
/// </summary>
private void SetTimeToControl()
{
this.txtYear.Text = currentTime.Year.ToString();
this.txtMonth.Text = currentTime.Month.ToString().PadLeft(2, '0');
this.txtDay.Text = currentTime.Day.ToString().PadLeft(2, '0');
this.txtHour.Text = currentTime.Hour.ToString().PadLeft(2, '0');
this.txtMinute.Text = currentTime.Minute.ToString().PadLeft(2, '0');
}
/// <summary>
/// Initializes a new instance of the <see cref="UCDatePickerExt" /> class.
/// </summary>
public UCDatePickerExt()
{
InitializeComponent();
}
/// <summary>
/// Handles the Load event of the UCDatePickerExt control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void UCDatePickerExt_Load(object sender, EventArgs e)
{
SetTimeToControl();
panel1.Height = this.txtDay.Height;
panel1.Height = this.txtHour.Height;
SetEvent(this);
}
/// <summary>
/// Sets the event.
/// </summary>
/// <param name="c">The c.</param>
private void SetEvent(Control c)
{
if (c != null)
{
c.MouseDown += c_MouseDown;
foreach (Control item in c.Controls)
{
SetEvent(item);
}
}
}
/// <summary>
/// Handles the MouseDown event of the c control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
void c_MouseDown(object sender, MouseEventArgs e)
{
if (m_selectPan == null)
{
m_selectPan = new UCDateTimeSelectPan();
m_selectPan.SelectedTimeEvent += uc_SelectedTimeEvent;
m_selectPan.CancelTimeEvent += m_selectPan_CancelTimeEvent;
}
m_selectPan.CurrentTime = currentTime;
m_selectPan.TimeType = m_type;
m_frmAnchor = new Forms.FrmAnchor(this, m_selectPan);
m_frmAnchor.Show(this.FindForm());
}
/// <summary>
/// Handles the CancelTimeEvent event of the m_selectPan control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void m_selectPan_CancelTimeEvent(object sender, EventArgs e)
{
m_frmAnchor.Hide();
}
/// <summary>
/// Handles the SelectedTimeEvent event of the uc control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void uc_SelectedTimeEvent(object sender, EventArgs e)
{
CurrentTime = m_selectPan.CurrentTime;
m_frmAnchor.Hide();
}
/// <summary>
/// Handles the TextChanged event of the txtYear control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtYear_TextChanged(object sender, EventArgs e)
{
if (txtYear.Text.Length == 4)
this.ActiveControl = txtMonth;
}
/// <summary>
/// Handles the TextChanged event of the txtMonth control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtMonth_TextChanged(object sender, EventArgs e)
{
if (txtMonth.Text.Length == 2 || txtMonth.Text.ToInt() >= 3)
{
this.ActiveControl = txtDay;
}
}
/// <summary>
/// Handles the TextChanged event of the txtDay control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtDay_TextChanged(object sender, EventArgs e)
{
if (m_type == DateTimePickerType.Date)
return;
if (txtDay.Text.Length == 2 || txtDay.Text.ToInt() >= 4)
{
this.ActiveControl = txtHour;
}
}
/// <summary>
/// Handles the TextChanged event of the txtHour control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtHour_TextChanged(object sender, EventArgs e)
{
if (txtHour.Text.Length == 2 || txtHour.Text.ToInt() >= 3)
{
this.ActiveControl = txtMinute;
}
}
/// <summary>
/// Handles the Leave event of the txtYear control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtYear_Leave(object sender, EventArgs e)
{
if (txtYear.Text.ToInt() < 1990)
{
txtYear.Text = currentTime.Year.ToString();
}
currentTime = (txtYear.Text + currentTime.ToString("-MM-dd HH:mm:ss")).ToDate();
}
/// <summary>
/// Handles the Leave event of the txtMonth control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtMonth_Leave(object sender, EventArgs e)
{
if (txtMonth.Text.ToInt() < 1)
{
txtMonth.Text = currentTime.Month.ToString().PadLeft(2, '0');
}
txtMonth.Text = txtMonth.Text.PadLeft(2, '0');
currentTime = (currentTime.ToString("yyyy-" + txtMonth.Text + "-dd HH:mm:ss")).ToDate();
}
/// <summary>
/// Handles the Leave event of the txtDay control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtDay_Leave(object sender, EventArgs e)
{
if (txtDay.Text.ToInt() < 1 || txtDay.Text.ToInt() > DateTime.DaysInMonth(currentTime.Year, currentTime.Month))
{
txtDay.Text = currentTime.Day.ToString().PadLeft(2, '0');
}
txtDay.Text = txtDay.Text.PadLeft(2, '0');
currentTime = (currentTime.ToString("yyyy-MM-" + txtDay.Text + " HH:mm:ss")).ToDate();
}
/// <summary>
/// Handles the Leave event of the txtHour control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtHour_Leave(object sender, EventArgs e)
{
if (txtHour.Text.ToInt() < 1)
{
txtHour.Text = currentTime.Hour.ToString().PadLeft(2, '0');
}
txtHour.Text = txtHour.Text.PadLeft(2, '0');
currentTime = (currentTime.ToString("yyyy-MM-dd " + txtHour.Text + ":mm:ss")).ToDate();
}
/// <summary>
/// Handles the Leave event of the txtMinute control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txtMinute_Leave(object sender, EventArgs e)
{
if (txtMinute.Text.ToInt() < 1)
{
txtMinute.Text = currentTime.Minute.ToString().PadLeft(2, '0');
}
txtMinute.Text = txtMinute.Text.PadLeft(2, '0');
currentTime = (currentTime.ToString("yyyy-MM-dd HH:" + txtMinute.Text + ":ss")).ToDate();
}
/// <summary>
/// Handles the SizeChanged event of the txt control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void txt_SizeChanged(object sender, EventArgs e)
{
panel1.Height = (sender as TextBoxEx).Height;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,504 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCDateTimeSelectPan.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCDateTimeSelectPan.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public partial class UCDateTimeSelectPan
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.btnMinute = new HZH_Controls.Controls.UCBtnExt();
this.sp4 = new System.Windows.Forms.Panel();
this.btnHour = new HZH_Controls.Controls.UCBtnExt();
this.sp3 = new System.Windows.Forms.Panel();
this.btnDay = new HZH_Controls.Controls.UCBtnExt();
this.sp2 = new System.Windows.Forms.Panel();
this.btnMonth = new HZH_Controls.Controls.UCBtnExt();
this.sp1 = new System.Windows.Forms.Panel();
this.btnYear = new HZH_Controls.Controls.UCBtnExt();
this.panel2 = new System.Windows.Forms.Panel();
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
this.btnOk = new HZH_Controls.Controls.UCBtnExt();
this.panMian = new System.Windows.Forms.Panel();
this.panTime = new HZH_Controls.Controls.UCTimePanel();
this.panRight = new System.Windows.Forms.Panel();
this.panLeft = new System.Windows.Forms.Panel();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.panel3 = new System.Windows.Forms.Panel();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panMian.SuspendLayout();
this.panel3.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.btnMinute);
this.panel1.Controls.Add(this.sp4);
this.panel1.Controls.Add(this.btnHour);
this.panel1.Controls.Add(this.sp3);
this.panel1.Controls.Add(this.btnDay);
this.panel1.Controls.Add(this.sp2);
this.panel1.Controls.Add(this.btnMonth);
this.panel1.Controls.Add(this.sp1);
this.panel1.Controls.Add(this.btnYear);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(9, 9);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(10, 7, 10, 7);
this.panel1.Size = new System.Drawing.Size(497, 45);
this.panel1.TabIndex = 0;
//
// btnMinute
//
this.btnMinute.BackColor = System.Drawing.Color.Transparent;
this.btnMinute.BtnBackColor = System.Drawing.Color.Transparent;
this.btnMinute.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
this.btnMinute.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnMinute.BtnText = "30分";
this.btnMinute.ConerRadius = 5;
this.btnMinute.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnMinute.Dock = System.Windows.Forms.DockStyle.Left;
this.btnMinute.FillColor = System.Drawing.Color.White;
this.btnMinute.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnMinute.IsRadius = true;
this.btnMinute.IsShowRect = true;
this.btnMinute.IsShowTips = false;
this.btnMinute.Location = new System.Drawing.Point(406, 7);
this.btnMinute.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnMinute.Name = "btnMinute";
this.btnMinute.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnMinute.RectWidth = 1;
this.btnMinute.Size = new System.Drawing.Size(80, 31);
this.btnMinute.TabIndex = 1;
this.btnMinute.TabStop = false;
this.btnMinute.TipsText = "";
this.btnMinute.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
//
// sp4
//
this.sp4.Dock = System.Windows.Forms.DockStyle.Left;
this.sp4.Location = new System.Drawing.Point(387, 7);
this.sp4.Name = "sp4";
this.sp4.Size = new System.Drawing.Size(19, 31);
this.sp4.TabIndex = 5;
//
// btnHour
//
this.btnHour.BackColor = System.Drawing.Color.Transparent;
this.btnHour.BtnBackColor = System.Drawing.Color.Transparent;
this.btnHour.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
this.btnHour.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnHour.BtnText = "12时";
this.btnHour.ConerRadius = 5;
this.btnHour.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHour.Dock = System.Windows.Forms.DockStyle.Left;
this.btnHour.FillColor = System.Drawing.Color.White;
this.btnHour.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnHour.IsRadius = true;
this.btnHour.IsShowRect = true;
this.btnHour.IsShowTips = false;
this.btnHour.Location = new System.Drawing.Point(307, 7);
this.btnHour.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnHour.Name = "btnHour";
this.btnHour.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnHour.RectWidth = 1;
this.btnHour.Size = new System.Drawing.Size(80, 31);
this.btnHour.TabIndex = 1;
this.btnHour.TabStop = false;
this.btnHour.TipsText = "";
this.btnHour.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
//
// sp3
//
this.sp3.Dock = System.Windows.Forms.DockStyle.Left;
this.sp3.Location = new System.Drawing.Point(288, 7);
this.sp3.Name = "sp3";
this.sp3.Size = new System.Drawing.Size(19, 31);
this.sp3.TabIndex = 4;
//
// btnDay
//
this.btnDay.BackColor = System.Drawing.Color.Transparent;
this.btnDay.BtnBackColor = System.Drawing.Color.Transparent;
this.btnDay.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
this.btnDay.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnDay.BtnText = "30日";
this.btnDay.ConerRadius = 5;
this.btnDay.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDay.Dock = System.Windows.Forms.DockStyle.Left;
this.btnDay.FillColor = System.Drawing.Color.White;
this.btnDay.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnDay.IsRadius = true;
this.btnDay.IsShowRect = true;
this.btnDay.IsShowTips = false;
this.btnDay.Location = new System.Drawing.Point(208, 7);
this.btnDay.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnDay.Name = "btnDay";
this.btnDay.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnDay.RectWidth = 1;
this.btnDay.Size = new System.Drawing.Size(80, 31);
this.btnDay.TabIndex = 1;
this.btnDay.TabStop = false;
this.btnDay.TipsText = "";
this.btnDay.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
//
// sp2
//
this.sp2.Dock = System.Windows.Forms.DockStyle.Left;
this.sp2.Location = new System.Drawing.Point(189, 7);
this.sp2.Name = "sp2";
this.sp2.Size = new System.Drawing.Size(19, 31);
this.sp2.TabIndex = 3;
//
// btnMonth
//
this.btnMonth.BackColor = System.Drawing.Color.Transparent;
this.btnMonth.BtnBackColor = System.Drawing.Color.Transparent;
this.btnMonth.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
this.btnMonth.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnMonth.BtnText = "12月";
this.btnMonth.ConerRadius = 5;
this.btnMonth.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnMonth.Dock = System.Windows.Forms.DockStyle.Left;
this.btnMonth.FillColor = System.Drawing.Color.White;
this.btnMonth.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnMonth.IsRadius = true;
this.btnMonth.IsShowRect = true;
this.btnMonth.IsShowTips = false;
this.btnMonth.Location = new System.Drawing.Point(109, 7);
this.btnMonth.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnMonth.Name = "btnMonth";
this.btnMonth.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnMonth.RectWidth = 1;
this.btnMonth.Size = new System.Drawing.Size(80, 31);
this.btnMonth.TabIndex = 1;
this.btnMonth.TabStop = false;
this.btnMonth.TipsText = "";
this.btnMonth.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
//
// sp1
//
this.sp1.Dock = System.Windows.Forms.DockStyle.Left;
this.sp1.Location = new System.Drawing.Point(90, 7);
this.sp1.Name = "sp1";
this.sp1.Size = new System.Drawing.Size(19, 31);
this.sp1.TabIndex = 2;
//
// btnYear
//
this.btnYear.BackColor = System.Drawing.Color.Transparent;
this.btnYear.BtnBackColor = System.Drawing.Color.Transparent;
this.btnYear.BtnFont = new System.Drawing.Font("微软雅黑", 12F);
this.btnYear.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnYear.BtnText = "2019年";
this.btnYear.ConerRadius = 5;
this.btnYear.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnYear.Dock = System.Windows.Forms.DockStyle.Left;
this.btnYear.FillColor = System.Drawing.Color.White;
this.btnYear.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnYear.IsRadius = true;
this.btnYear.IsShowRect = true;
this.btnYear.IsShowTips = false;
this.btnYear.Location = new System.Drawing.Point(10, 7);
this.btnYear.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnYear.Name = "btnYear";
this.btnYear.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnYear.RectWidth = 1;
this.btnYear.Size = new System.Drawing.Size(80, 31);
this.btnYear.TabIndex = 1;
this.btnYear.TabStop = false;
this.btnYear.TipsText = "";
this.btnYear.BtnClick += new System.EventHandler(this.btnTime_BtnClick);
//
// panel2
//
this.panel2.Controls.Add(this.btnCancel);
this.panel2.Controls.Add(this.btnOk);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(9, 300);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(497, 54);
this.panel2.TabIndex = 2;
//
// btnCancel
//
this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 13F);
this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnCancel.BtnText = "取 消";
this.btnCancel.ConerRadius = 5;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.FillColor = System.Drawing.Color.White;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnCancel.IsRadius = true;
this.btnCancel.IsShowRect = true;
this.btnCancel.IsShowTips = false;
this.btnCancel.Location = new System.Drawing.Point(89, 9);
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnCancel.Name = "btnCancel";
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnCancel.RectWidth = 1;
this.btnCancel.Size = new System.Drawing.Size(129, 36);
this.btnCancel.TabIndex = 2;
this.btnCancel.TabStop = false;
this.btnCancel.TipsText = "";
this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick);
//
// btnOk
//
this.btnOk.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btnOk.BackColor = System.Drawing.Color.Transparent;
this.btnOk.BtnBackColor = System.Drawing.Color.Transparent;
this.btnOk.BtnFont = new System.Drawing.Font("微软雅黑", 13F);
this.btnOk.BtnForeColor = System.Drawing.Color.White;
this.btnOk.BtnText = "确 定";
this.btnOk.ConerRadius = 5;
this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOk.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnOk.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnOk.IsRadius = true;
this.btnOk.IsShowRect = true;
this.btnOk.IsShowTips = false;
this.btnOk.Location = new System.Drawing.Point(307, 9);
this.btnOk.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnOk.Name = "btnOk";
this.btnOk.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnOk.RectWidth = 1;
this.btnOk.Size = new System.Drawing.Size(129, 36);
this.btnOk.TabIndex = 1;
this.btnOk.TabStop = false;
this.btnOk.TipsText = "";
this.btnOk.BtnClick += new System.EventHandler(this.btnOk_BtnClick);
//
// panMian
//
this.panMian.Controls.Add(this.panTime);
this.panMian.Controls.Add(this.panRight);
this.panMian.Controls.Add(this.panLeft);
this.panMian.Dock = System.Windows.Forms.DockStyle.Fill;
this.panMian.Location = new System.Drawing.Point(9, 55);
this.panMian.Name = "panMian";
this.panMian.Size = new System.Drawing.Size(497, 244);
this.panMian.TabIndex = 4;
//
// panTime
//
this.panTime.BackColor = System.Drawing.Color.White;
this.panTime.Column = 0;
this.panTime.Dock = System.Windows.Forms.DockStyle.Fill;
this.panTime.FirstEvent = false;
this.panTime.Location = new System.Drawing.Point(48, 0);
this.panTime.Name = "panTime";
this.panTime.Row = 0;
this.panTime.SelectBtn = null;
this.panTime.Size = new System.Drawing.Size(401, 244);
this.panTime.Source = null;
this.panTime.TabIndex = 0;
//
// panRight
//
this.panRight.BackgroundImage = global::HZH_Controls.Properties.Resources.dateRight;
this.panRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panRight.Dock = System.Windows.Forms.DockStyle.Right;
this.panRight.Location = new System.Drawing.Point(449, 0);
this.panRight.Name = "panRight";
this.panRight.Size = new System.Drawing.Size(48, 244);
this.panRight.TabIndex = 2;
this.panRight.Visible = false;
this.panRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panRight_MouseDown);
//
// panLeft
//
this.panLeft.BackgroundImage = global::HZH_Controls.Properties.Resources.datetLeft;
this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.panLeft.Location = new System.Drawing.Point(0, 0);
this.panLeft.Name = "panLeft";
this.panLeft.Size = new System.Drawing.Size(48, 244);
this.panLeft.TabIndex = 1;
this.panLeft.Visible = false;
this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown);
//
// ucSplitLine_H2
//
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H2.Location = new System.Drawing.Point(9, 299);
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
this.ucSplitLine_H2.Size = new System.Drawing.Size(497, 1);
this.ucSplitLine_H2.TabIndex = 3;
this.ucSplitLine_H2.TabStop = false;
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
this.ucSplitLine_H1.Location = new System.Drawing.Point(9, 54);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(497, 1);
this.ucSplitLine_H1.TabIndex = 1;
this.ucSplitLine_H1.TabStop = false;
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Controls.Add(this.panMian);
this.panel3.Controls.Add(this.ucSplitLine_H2);
this.panel3.Controls.Add(this.panel2);
this.panel3.Controls.Add(this.ucSplitLine_H1);
this.panel3.Controls.Add(this.panel1);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(1, 1);
this.panel3.Name = "panel3";
this.panel3.Padding = new System.Windows.Forms.Padding(9);
this.panel3.Size = new System.Drawing.Size(515, 363);
this.panel3.TabIndex = 5;
//
// UCDateTimeSelectPan
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.Controls.Add(this.panel3);
this.Name = "UCDateTimeSelectPan";
this.Padding = new System.Windows.Forms.Padding(1);
this.Size = new System.Drawing.Size(517, 365);
this.Load += new System.EventHandler(this.UCDateTimePickerExt_Load);
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panMian.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The panel1
/// </summary>
private System.Windows.Forms.Panel panel1;
/// <summary>
/// The uc split line h1
/// </summary>
private UCSplitLine_H ucSplitLine_H1;
/// <summary>
/// The panel2
/// </summary>
private System.Windows.Forms.Panel panel2;
/// <summary>
/// The uc split line h2
/// </summary>
private UCSplitLine_H ucSplitLine_H2;
/// <summary>
/// The pan mian
/// </summary>
private System.Windows.Forms.Panel panMian;
/// <summary>
/// The BTN minute
/// </summary>
private UCBtnExt btnMinute;
/// <summary>
/// The BTN day
/// </summary>
private UCBtnExt btnDay;
/// <summary>
/// The BTN hour
/// </summary>
private UCBtnExt btnHour;
/// <summary>
/// The BTN month
/// </summary>
private UCBtnExt btnMonth;
/// <summary>
/// The BTN year
/// </summary>
private UCBtnExt btnYear;
/// <summary>
/// The pan time
/// </summary>
private UCTimePanel panTime;
/// <summary>
/// The BTN cancel
/// </summary>
private UCBtnExt btnCancel;
/// <summary>
/// The BTN ok
/// </summary>
private UCBtnExt btnOk;
/// <summary>
/// The pan right
/// </summary>
private System.Windows.Forms.Panel panRight;
/// <summary>
/// The pan left
/// </summary>
private System.Windows.Forms.Panel panLeft;
/// <summary>
/// The SP4
/// </summary>
private System.Windows.Forms.Panel sp4;
/// <summary>
/// The SP3
/// </summary>
private System.Windows.Forms.Panel sp3;
/// <summary>
/// The SP2
/// </summary>
private System.Windows.Forms.Panel sp2;
/// <summary>
/// The SP1
/// </summary>
private System.Windows.Forms.Panel sp1;
/// <summary>
/// The panel3
/// </summary>
private System.Windows.Forms.Panel panel3;
}
}

View File

@@ -0,0 +1,398 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCDateTimeSelectPan.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCDateTimeSelectPan.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[ToolboxItem(false)]
public partial class UCDateTimeSelectPan : UserControl
{
/// <summary>
/// Occurs when [selected time event].
/// </summary>
[Description("确定事件"), Category("自定义")]
public event EventHandler SelectedTimeEvent;
/// <summary>
/// Occurs when [cancel time event].
/// </summary>
[Description("取消事件"), Category("自定义")]
public event EventHandler CancelTimeEvent;
/// <summary>
/// The automatic select next
/// </summary>
private bool autoSelectNext = true;
/// <summary>
/// Gets or sets a value indicating whether [automatic select next].
/// </summary>
/// <value><c>true</c> if [automatic select next]; otherwise, <c>false</c>.</value>
[Description("自动选中下一级"), Category("自定义")]
public bool AutoSelectNext
{
get { return autoSelectNext; }
set { autoSelectNext = value; }
}
/// <summary>
/// The m dt
/// </summary>
DateTime m_dt = DateTime.Now;
/// <summary>
/// Gets or sets the current time.
/// </summary>
/// <value>The current time.</value>
public DateTime CurrentTime
{
get { return m_dt; }
set
{
m_dt = value;
SetTimeToControl();
}
}
/// <summary>
/// The m this BTN
/// </summary>
UCBtnExt m_thisBtn = null;
/// <summary>
/// The m type
/// </summary>
DateTimePickerType m_type = DateTimePickerType.DateTime;
/// <summary>
/// Gets or sets the type of the time.
/// </summary>
/// <value>The type of the time.</value>
[Description("时间类型"), Category("自定义")]
public DateTimePickerType TimeType
{
get { return m_type; }
set { m_type = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="UCDateTimeSelectPan" /> class.
/// </summary>
public UCDateTimeSelectPan()
{
InitializeComponent();
panTime.SelectSourceEvent += panTime_SelectSourceEvent;
this.TabStop = false;
}
/// <summary>
/// Initializes a new instance of the <see cref="UCDateTimeSelectPan" /> class.
/// </summary>
/// <param name="dt">The dt.</param>
public UCDateTimeSelectPan(DateTime dt)
{
m_dt = dt;
InitializeComponent();
panTime.SelectSourceEvent += panTime_SelectSourceEvent;
this.TabStop = false;
}
/// <summary>
/// Handles the SelectSourceEvent event of the panTime control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void panTime_SelectSourceEvent(object sender, EventArgs e)
{
string strKey = sender.ToString();
if (m_thisBtn == btnYear)
{
m_dt = (strKey + "-" + m_dt.Month + "-" + m_dt.Day + " " + m_dt.Hour + ":" + m_dt.Minute).ToDate();
}
else if (m_thisBtn == btnMonth)
{
m_dt = (m_dt.Year + "-" + strKey + "-" + m_dt.Day + " " + m_dt.Hour + ":" + m_dt.Minute).ToDate();
}
else if (m_thisBtn == btnDay)
{
m_dt = (m_dt.Year + "-" + m_dt.Month + "-" + strKey + " " + m_dt.Hour + ":" + m_dt.Minute).ToDate();
}
else if (m_thisBtn == btnHour)
{
m_dt = (m_dt.Year + "-" + m_dt.Month + "-" + m_dt.Day + " " + strKey + ":" + m_dt.Minute).ToDate();
}
else if (m_thisBtn == btnMinute)
{
m_dt = (m_dt.Year + "-" + m_dt.Month + "-" + m_dt.Day + " " + m_dt.Hour + ":" + strKey).ToDate();
}
SetTimeToControl();
if (this.Visible)
{
if (autoSelectNext)
{
if (m_thisBtn == btnYear)
{
SetSelectType(btnMonth);
}
else if (m_thisBtn == btnMonth)
{
SetSelectType(btnDay);
}
else if (m_thisBtn == btnDay)
{
if (m_type == DateTimePickerType.DateTime || m_type == DateTimePickerType.Time)
SetSelectType(btnHour);
}
else if (m_thisBtn == btnHour)
{
SetSelectType(btnMinute);
}
}
}
}
/// <summary>
/// Handles the Load event of the UCDateTimePickerExt control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void UCDateTimePickerExt_Load(object sender, EventArgs e)
{
SetTimeToControl();
if (m_type == DateTimePickerType.Date)
{
btnHour.Visible = false;
btnMinute.Visible = false;
}
else if (m_type == DateTimePickerType.Time)
{
btnYear.Visible = false;
btnMonth.Visible = false;
btnDay.Visible = false;
sp1.Visible = false;
sp2.Visible = false;
sp3.Visible = false;
}
if ((int)m_type <= 2)
{
SetSelectType(btnYear);
}
else
{
SetSelectType(btnHour);
}
}
/// <summary>
/// Sets the time to control.
/// </summary>
private void SetTimeToControl()
{
btnYear.Tag = m_dt.Year;
btnYear.BtnText = m_dt.Year + "年";
btnMonth.Tag = m_dt.Month;
btnMonth.BtnText = m_dt.Month.ToString().PadLeft(2, '0') + "月";
btnDay.Tag = m_dt.Day;
btnDay.BtnText = m_dt.Day.ToString().PadLeft(2, '0') + "日";
btnHour.Tag = m_dt.Hour;
btnHour.BtnText = m_dt.Hour.ToString().PadLeft(2, '0') + "时";
btnMinute.Tag = m_dt.Minute;
btnMinute.BtnText = m_dt.Minute.ToString().PadLeft(2, '0') + "分";
}
/// <summary>
/// Sets the type of the select.
/// </summary>
/// <param name="btn">The BTN.</param>
private void SetSelectType(UCBtnExt btn)
{
try
{
ControlHelper.FreezeControl(this, true);
if (m_thisBtn != null)
{
m_thisBtn.FillColor = Color.White;
m_thisBtn.BtnForeColor = Color.FromArgb(255, 77, 59);
}
m_thisBtn = btn;
if (m_thisBtn != null)
{
m_thisBtn.FillColor = Color.FromArgb(255, 77, 59);
m_thisBtn.BtnForeColor = Color.White;
List<KeyValuePair<string, string>> lstSource = new List<KeyValuePair<string, string>>();
panTime.SuspendLayout();
if (btn == btnYear)
{
panLeft.Visible = true;
panRight.Visible = true;
}
else
{
panLeft.Visible = false;
panRight.Visible = false;
}
if (btn == btnYear)
{
panTime.Row = 5;
panTime.Column = 6;
int intYear = m_dt.Year - m_dt.Year % 30;
for (int i = 0; i < 30; i++)
{
lstSource.Add(new KeyValuePair<string, string>((intYear + i).ToString(), (intYear + i).ToString()));
}
}
else if (btn == btnMonth)
{
panTime.Row = 3;
panTime.Column = 4;
for (int i = 1; i <= 12; i++)
{
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString().PadLeft(2, '0') + "月\r\n" + (("2019-" + i + "-01").ToDate().ToString("MMM", System.Globalization.CultureInfo.CreateSpecificCulture("en-GB")))));
}
}
else if (btn == btnDay)
{
panTime.Column = 7;
int intDayCount = DateTime.DaysInMonth(m_dt.Year, m_dt.Month);
int intIndex = (int)(m_dt.DayOfWeek);
panTime.Row = (intDayCount + intIndex) / 7 + ((intDayCount + intIndex) % 7 != 0 ? 1 : 0);
for (int i = 0; i < intIndex; i++)
{
lstSource.Add(new KeyValuePair<string, string>("", ""));
}
for (int i = 1; i <= intDayCount; i++)
{
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString().PadLeft(2, '0')));
}
}
else if (btn == btnHour)
{
panTime.Row = 4;
panTime.Column = 6;
for (int i = 0; i <= 24; i++)
{
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString() + "时"));
}
}
else if (btn == btnMinute)
{
panTime.Row = 5;
panTime.Column = 12;
for (int i = 0; i <= 60; i++)
{
lstSource.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString().PadLeft(2, '0')));
}
}
panTime.Source = lstSource;
panTime.SetSelect(btn.Tag.ToStringExt());
panTime.ResumeLayout(true);
// panTime.Enabled = true;
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
/// <summary>
/// Handles the BtnClick event of the btnTime control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnTime_BtnClick(object sender, EventArgs e)
{
SetSelectType((UCBtnExt)sender);
}
/// <summary>
/// Handles the MouseDown event of the panLeft control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panLeft_MouseDown(object sender, MouseEventArgs e)
{
List<KeyValuePair<string, string>> lstSource = new List<KeyValuePair<string, string>>();
int intYear = this.panTime.Source[0].Key.ToInt() - this.panTime.Source[0].Key.ToInt() % 30 - 30;
panTime.SuspendLayout();
panTime.Row = 5;
panTime.Column = 6;
for (int i = 0; i < 30; i++)
{
lstSource.Add(new KeyValuePair<string, string>((intYear + i).ToString(), (intYear + i).ToString()));
}
panTime.Source = lstSource;
panTime.SetSelect(btnYear.Tag.ToStringExt());
panTime.ResumeLayout(true);
}
/// <summary>
/// Handles the MouseDown event of the panRight control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void panRight_MouseDown(object sender, MouseEventArgs e)
{
List<KeyValuePair<string, string>> lstSource = new List<KeyValuePair<string, string>>();
int intYear = this.panTime.Source[0].Key.ToInt() - this.panTime.Source[0].Key.ToInt() % 30 + 30;
panTime.SuspendLayout();
panTime.Row = 5;
panTime.Column = 6;
for (int i = 0; i < 30; i++)
{
lstSource.Add(new KeyValuePair<string, string>((intYear + i).ToString(), (intYear + i).ToString()));
}
panTime.Source = lstSource;
panTime.SetSelect(btnYear.Tag.ToStringExt());
panTime.ResumeLayout(true);
}
/// <summary>
/// Handles the BtnClick event of the btnOk control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnOk_BtnClick(object sender, EventArgs e)
{
if (SelectedTimeEvent != null)
SelectedTimeEvent(m_dt, null);
}
/// <summary>
/// Handles the BtnClick event of the btnCancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnCancel_BtnClick(object sender, EventArgs e)
{
if (CancelTimeEvent != null)
{
CancelTimeEvent(null, null);
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,154 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCTimePanel.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCTimePanel.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCTimePanel
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.panMain = new System.Windows.Forms.TableLayoutPanel();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.SuspendLayout();
//
// panMain
//
this.panMain.ColumnCount = 1;
this.panMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panMain.Location = new System.Drawing.Point(1, 1);
this.panMain.Name = "panMain";
this.panMain.RowCount = 1;
this.panMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.panMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.panMain.Size = new System.Drawing.Size(99, 228);
this.panMain.TabIndex = 0;
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 0);
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 230);
this.ucSplitLine_V1.TabIndex = 0;
this.ucSplitLine_V1.TabStop = false;
this.ucSplitLine_V1.Visible = false;
//
// ucSplitLine_V2
//
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_V2.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitLine_V2.Location = new System.Drawing.Point(100, 0);
this.ucSplitLine_V2.Name = "ucSplitLine_V2";
this.ucSplitLine_V2.Size = new System.Drawing.Size(1, 230);
this.ucSplitLine_V2.TabIndex = 1;
this.ucSplitLine_V2.TabStop = false;
this.ucSplitLine_V2.Visible = false;
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
this.ucSplitLine_H1.Location = new System.Drawing.Point(1, 0);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(99, 1);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
this.ucSplitLine_H1.Visible = false;
//
// ucSplitLine_H2
//
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H2.Location = new System.Drawing.Point(1, 229);
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
this.ucSplitLine_H2.Size = new System.Drawing.Size(99, 1);
this.ucSplitLine_H2.TabIndex = 2;
this.ucSplitLine_H2.TabStop = false;
this.ucSplitLine_H2.Visible = false;
//
// UCTimePanel
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panMain);
this.Controls.Add(this.ucSplitLine_H2);
this.Controls.Add(this.ucSplitLine_H1);
this.Controls.Add(this.ucSplitLine_V2);
this.Controls.Add(this.ucSplitLine_V1);
this.Name = "UCTimePanel";
this.Size = new System.Drawing.Size(101, 230);
this.Load += new System.EventHandler(this.UCTimePanel_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The pan main
/// </summary>
private System.Windows.Forms.TableLayoutPanel panMain;
/// <summary>
/// The uc split line v1
/// </summary>
private UCSplitLine_V ucSplitLine_V1;
/// <summary>
/// The uc split line v2
/// </summary>
private UCSplitLine_V ucSplitLine_V2;
/// <summary>
/// The uc split line h1
/// </summary>
private UCSplitLine_H ucSplitLine_H1;
/// <summary>
/// The uc split line h2
/// </summary>
private UCSplitLine_H ucSplitLine_H2;
}
}

View File

@@ -0,0 +1,317 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCTimePanel.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCTimePanel.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[ToolboxItem(false)]
public partial class UCTimePanel : UserControl
{
/// <summary>
/// Occurs when [select source event].
/// </summary>
public event EventHandler SelectSourceEvent;
/// <summary>
/// The source
/// </summary>
private List<KeyValuePair<string, string>> source = null;
/// <summary>
/// Gets or sets a value indicating whether [first event].
/// </summary>
/// <value><c>true</c> if [first event]; otherwise, <c>false</c>.</value>
public bool FirstEvent { get; set; }
/// <summary>
/// Gets or sets the source.
/// </summary>
/// <value>The source.</value>
public List<KeyValuePair<string, string>> Source
{
get { return source; }
set
{
source = value;
SetSource(value);
}
}
/// <summary>
/// The is show border
/// </summary>
private bool _IsShowBorder = false;
/// <summary>
/// Gets or sets a value indicating whether this instance is show border.
/// </summary>
/// <value><c>true</c> if this instance is show border; otherwise, <c>false</c>.</value>
public bool IsShowBorder
{
get { return _IsShowBorder; }
set
{
_IsShowBorder = value;
ucSplitLine_H1.Visible = value;
ucSplitLine_H2.Visible = value;
ucSplitLine_V1.Visible = value;
ucSplitLine_V2.Visible = value;
}
}
/// <summary>
/// The select BTN
/// </summary>
UCBtnExt selectBtn;
/// <summary>
/// 选中按钮
/// </summary>
/// <value>The select BTN.</value>
public UCBtnExt SelectBtn
{
get { return selectBtn; }
set
{
if (selectBtn != null && !selectBtn.IsDisposed)
{
selectBtn.FillColor = System.Drawing.Color.White;
selectBtn.RectColor = System.Drawing.Color.White;
selectBtn.BtnForeColor = System.Drawing.Color.FromArgb(66, 66, 66);
}
bool blnEvent = FirstEvent ? true : (selectBtn != null);
selectBtn = value;
if (value != null)
{
selectBtn.FillColor = System.Drawing.Color.FromArgb(255, 77, 59);
selectBtn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
selectBtn.BtnForeColor = System.Drawing.Color.White;
if (blnEvent && SelectSourceEvent != null)
SelectSourceEvent(selectBtn.Tag.ToStringExt(), null);
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCTimePanel" /> class.
/// </summary>
public UCTimePanel()
{
InitializeComponent();
this.SizeChanged += UCTimePanel_SizeChanged;
}
/// <summary>
/// Handles the SizeChanged event of the UCTimePanel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void UCTimePanel_SizeChanged(object sender, EventArgs e)
{
}
/// <summary>
/// The row
/// </summary>
private int row = 0;
/// <summary>
/// Gets or sets the row.
/// </summary>
/// <value>The row.</value>
public int Row
{
get { return row; }
set
{
row = value;
ReloadPanel();
}
}
/// <summary>
/// The column
/// </summary>
private int column = 0;
/// <summary>
/// Gets or sets the column.
/// </summary>
/// <value>The column.</value>
public int Column
{
get { return column; }
set
{
column = value;
ReloadPanel();
}
}
/// <summary>
/// Handles the Load event of the UCTimePanel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void UCTimePanel_Load(object sender, EventArgs e)
{
}
#region
/// <summary>
/// 功能描述:设置面板数据源
/// 作  者:HZH
/// 创建日期:2019-06-25 15:02:15
/// 任务编号:POS
/// </summary>
/// <param name="lstSource">lstSource</param>
public void SetSource(List<KeyValuePair<string, string>> lstSource)
{
try
{
ControlHelper.FreezeControl(this, true);
if (row <= 0 || column <= 0)
return;
if (Source != lstSource)
Source = lstSource;
int index = 0;
SelectBtn = null;
foreach (UCBtnExt btn in this.panMain.Controls)
{
if (lstSource != null && index < lstSource.Count)
{
btn.BtnText = lstSource[index].Value;
btn.Tag = lstSource[index].Key;
index++;
}
else
{
btn.BtnText = "";
btn.Tag = null;
}
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
#endregion
/// <summary>
/// 设置选中项
/// </summary>
/// <param name="strKey">The string key.</param>
public void SetSelect(string strKey)
{
foreach (UCBtnExt item in this.panMain.Controls)
{
if (item.Tag != null && item.Tag.ToStringExt() == strKey)
{
SelectBtn = item;
return;
}
}
SelectBtn = new UCBtnExt();
}
#region
/// <summary>
/// 功能描述:重置面板
/// 作  者:HZH
/// 创建日期:2019-06-25 15:02:05
/// 任务编号:POS
/// </summary>
public void ReloadPanel()
{
if (row <= 0 || column <= 0)
return;
SelectBtn = null;
this.panMain.Controls.Clear();
this.panMain.ColumnCount = column;
this.panMain.ColumnStyles.Clear();
for (int i = 0; i < column; i++)
{
this.panMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
}
this.panMain.RowCount = row;
this.panMain.RowStyles.Clear();
for (int i = 0; i < row; i++)
{
this.panMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
}
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
UCBtnExt btn = new UCBtnExt();
btn.BackColor = System.Drawing.Color.Transparent;
btn.BtnBackColor = System.Drawing.Color.Transparent;
btn.BtnFont = new System.Drawing.Font("微软雅黑", 13F);
btn.BtnForeColor = System.Drawing.Color.FromArgb(66, 66, 66);
btn.ConerRadius = 5;
btn.Dock = DockStyle.Fill;
btn.FillColor = System.Drawing.Color.White;
btn.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
btn.Cursor = Cursor.Current;
btn.IsShowRect = true;
btn.IsRadius = true;
btn.IsShowTips = false;
btn.Name = "btn_" + i + "_" + j;
btn.RectColor = System.Drawing.Color.White;
btn.RectWidth = 1;
btn.Width = this.Width;
btn.TabIndex = 0;
btn.TipsText = "";
btn.BtnClick += btn_BtnClick;
this.panMain.Controls.Add(btn, j, i);
}
}
if (Source != null)
{
SetSource(Source);
}
}
#endregion
/// <summary>
/// Handles the BtnClick event of the btn control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void btn_BtnClick(object sender, EventArgs e)
{
var btn = (UCBtnExt)sender;
if (btn.Tag == null)
return;
SelectBtn = btn;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>