Calendar新增ShowButtonToday属性

This commit is contained in:
czz_y 2024-09-14 11:00:34 +08:00
parent 66d669dd0d
commit 33b72f0241
2 changed files with 79 additions and 3 deletions

View File

@ -33,13 +33,20 @@
this.divider1 = new AntdUI.Divider(); this.divider1 = new AntdUI.Divider();
this.label2 = new AntdUI.Label(); this.label2 = new AntdUI.Label();
this.label1 = new AntdUI.Label(); this.label1 = new AntdUI.Label();
this.flowPanel1 = new AntdUI.FlowPanel();
this.calendar = new AntdUI.Calendar(); this.calendar = new AntdUI.Calendar();
this.switch_showtoday = new AntdUI.Switch();
this.label6 = new AntdUI.Label();
this.switch_showchinese = new AntdUI.Switch();
this.label4 = new AntdUI.Label();
this.stackPanel1.SuspendLayout(); this.stackPanel1.SuspendLayout();
this.flowPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// stackPanel1 // stackPanel1
// //
this.stackPanel1.Controls.Add(this.calendar); this.stackPanel1.Controls.Add(this.calendar);
this.stackPanel1.Controls.Add(this.flowPanel1);
this.stackPanel1.Controls.Add(this.label3); this.stackPanel1.Controls.Add(this.label3);
this.stackPanel1.Controls.Add(this.divider1); this.stackPanel1.Controls.Add(this.divider1);
this.stackPanel1.Controls.Add(this.label2); this.stackPanel1.Controls.Add(this.label2);
@ -86,18 +93,68 @@
this.label1.TabIndex = 20; this.label1.TabIndex = 20;
this.label1.Text = "Calendar 日历"; this.label1.Text = "Calendar 日历";
// //
// flowPanel1
//
this.flowPanel1.Controls.Add(this.switch_showchinese);
this.flowPanel1.Controls.Add(this.label4);
this.flowPanel1.Controls.Add(this.switch_showtoday);
this.flowPanel1.Controls.Add(this.label6);
this.flowPanel1.Location = new System.Drawing.Point(3, 127);
this.flowPanel1.Name = "flowPanel1";
this.flowPanel1.Size = new System.Drawing.Size(694, 38);
this.flowPanel1.TabIndex = 25;
this.flowPanel1.Text = "flowPanel1";
//
// calendar // calendar
// //
this.calendar.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); this.calendar.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.calendar.Full = true; this.calendar.Full = true;
this.calendar.Location = new System.Drawing.Point(3, 127); this.calendar.Location = new System.Drawing.Point(3, 171);
this.calendar.Name = "calendar"; this.calendar.Name = "calendar";
this.calendar.ShowChinese = true; this.calendar.ShowChinese = true;
this.calendar.Size = new System.Drawing.Size(694, 414); this.calendar.Size = new System.Drawing.Size(694, 376);
this.calendar.TabIndex = 24; this.calendar.TabIndex = 26;
this.calendar.Text = "calendar1"; this.calendar.Text = "calendar1";
this.calendar.Value = new System.DateTime(2024, 8, 30, 8, 41, 9, 706); this.calendar.Value = new System.DateTime(2024, 8, 30, 8, 41, 9, 706);
// //
// switch_showtoday
//
this.switch_showtoday.AutoCheck = true;
this.switch_showtoday.Checked = true;
this.switch_showtoday.Location = new System.Drawing.Point(164, 3);
this.switch_showtoday.Name = "switch_showtoday";
this.switch_showtoday.Size = new System.Drawing.Size(60, 32);
this.switch_showtoday.TabIndex = 11;
this.switch_showtoday.Text = "switch1";
//
// label6
//
this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(3, 3);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(155, 32);
this.label6.TabIndex = 10;
this.label6.Text = "ShowButtonToday";
//
// switch_showchinese
//
this.switch_showchinese.AutoCheck = true;
this.switch_showchinese.Checked = true;
this.switch_showchinese.Location = new System.Drawing.Point(391, 3);
this.switch_showchinese.Name = "switch_showchinese";
this.switch_showchinese.Size = new System.Drawing.Size(60, 32);
this.switch_showchinese.TabIndex = 13;
this.switch_showchinese.Text = "switch1";
//
// label4
//
this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(230, 3);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(155, 32);
this.label4.TabIndex = 12;
this.label4.Text = "ShowChinese";
//
// CalendarDemo // CalendarDemo
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
@ -105,6 +162,7 @@
this.Name = "CalendarDemo"; this.Name = "CalendarDemo";
this.Size = new System.Drawing.Size(700, 550); this.Size = new System.Drawing.Size(700, 550);
this.stackPanel1.ResumeLayout(false); this.stackPanel1.ResumeLayout(false);
this.flowPanel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -117,5 +175,10 @@
private AntdUI.Label label1; private AntdUI.Label label1;
private AntdUI.Label label3; private AntdUI.Label label3;
private AntdUI.Calendar calendar; private AntdUI.Calendar calendar;
private AntdUI.FlowPanel flowPanel1;
private AntdUI.Switch switch_showtoday;
private AntdUI.Label label6;
private AntdUI.Switch switch_showchinese;
private AntdUI.Label label4;
} }
} }

View File

@ -1,4 +1,5 @@
using AntdUI; using AntdUI;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@ -20,6 +21,18 @@ namespace AntdUIDemo.Views
private void BindEventHandler() private void BindEventHandler()
{ {
calendar.DateChanged += Calendar_DateChanged; calendar.DateChanged += Calendar_DateChanged;
switch_showtoday.CheckedChanged += Switch_showtoday_CheckedChanged;
switch_showchinese.CheckedChanged += Switch_showchinese_CheckedChanged;
}
private void Switch_showchinese_CheckedChanged(object sender, BoolEventArgs e)
{
calendar.ShowChinese = e.Value;
}
private void Switch_showtoday_CheckedChanged(object sender, BoolEventArgs e)
{
calendar.ShowButtonToDay = e.Value;
} }
private void Calendar_DateChanged(object sender, DateTimeEventArgs e) private void Calendar_DateChanged(object sender, DateTimeEventArgs e)