* UIDatePicker: 修改选择日期在下拉框中显示方式

* UIDatetimePicker: 修改选择日期在下拉框中显示方式
This commit is contained in:
Sunny 2024-07-13 23:08:57 +08:00
parent 759f6f0901
commit 17adb334bf
4 changed files with 22 additions and 6 deletions

View File

@ -802,10 +802,15 @@ namespace Sunny.UI
int left = width * (i % 7);
int top = height * (i / 7);
Color color = (days[i].Month == Month) ? ForeColor : Color.DarkGray;
color = (days[i].DateString() == date.DateString()) ? PrimaryColor : color;
color = (days[i].DateString() == date.DateString()) ? b3.SymbolColor : color;
if (days[i] < min) color = Color.DarkGray;
if (days[i] > max) color = Color.DarkGray;
if (days[i].DateString() == date.DateString())
{
e.Graphics.DrawRectangle(b3.SymbolColor, new Rectangle(left + 1, top + 30 * SizeMultiple + 1, width - 2, height - 2));
}
if (!maxDrawer)
{
e.Graphics.DrawString(days[i].Day.ToString(), font, i == activeDay ? PrimaryColor : color, new Rectangle(left, top + 30 * SizeMultiple, width, height), ContentAlignment.MiddleCenter);
@ -821,8 +826,9 @@ namespace Sunny.UI
{
using Font SubFont = this.Font.DPIScaleFont(SizeMultiple == 1 ? 10.5f : 15.75f);
e.Graphics.FillRectangle(p3.FillColor, p3.Width - width * 4 + 1, p3.Height - height + 1, width * 4 - 2, height - 2);
e.Graphics.FillRoundRectangle(PrimaryColor, new Rectangle(p3.Width - width * 4 + 6, p3.Height - height + 3, 8, height - 10), 3);
e.Graphics.DrawString(UILocalize.Today + ": " + DateTime.Now.DateString(), SubFont, isToday ? PrimaryColor : Color.DarkGray, new Rectangle(p3.Width - width * 4 + 17, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft);
e.Graphics.DrawString(UILocalize.Today + " " + DateTime.Now.DateString(), SubFont, isToday ? b3.SymbolColor : Color.DarkGray, new Rectangle(p3.Width - width * 4, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft);
SizeF sf = TextRenderer.MeasureText(UILocalize.Today, SubFont);
e.Graphics.DrawRectangle(b3.SymbolColor, new Rectangle(p3.Width - width * 4 + 1, p3.Height - height + 1, (int)sf.Width - 2, height - 4));
}
}

View File

@ -1313,7 +1313,12 @@ namespace Sunny.UI
int left = width * (i % 7);
int top = height * (i / 7);
Color color = (days[i].Month == Month) ? ForeColor : Color.DarkGray;
color = (days[i].DateString() == date.DateString()) ? PrimaryColor : color;
color = (days[i].DateString() == date.DateString()) ? b3.SymbolColor : color;
if (days[i].DateString() == date.DateString())
{
e.Graphics.DrawRectangle(b3.SymbolColor, new Rectangle(left + 1, top + 30 * SizeMultiple + 1, width - 2, height - 2));
}
if (!maxDrawer)
{
@ -1330,8 +1335,9 @@ namespace Sunny.UI
{
using Font SubFont = this.Font.DPIScaleFont(SizeMultiple == 1 ? 10.5f : 15.75f);
e.Graphics.FillRectangle(p3.FillColor, p3.Width - width * 4 + 1, p3.Height - height + 1, width * 4 - 2, height - 2);
e.Graphics.FillRoundRectangle(PrimaryColor, new Rectangle(p3.Width - width * 4 + 6, p3.Height - height + 3, 8, height - 10), 3);
e.Graphics.DrawString(UILocalize.Today + ": " + DateTime.Now.DateString(), SubFont, isToday ? PrimaryColor : Color.DarkGray, new Rectangle(p3.Width - width * 4 + 17, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft);
e.Graphics.DrawString(UILocalize.Today + " " + DateTime.Now.DateString(), SubFont, isToday ? b3.SymbolColor : Color.DarkGray, new Rectangle(p3.Width - width * 4, p3.Height - height - 1, Width, height), ContentAlignment.MiddleLeft);
SizeF sf = TextRenderer.MeasureText(UILocalize.Today, SubFont);
e.Graphics.DrawRectangle(b3.SymbolColor, new Rectangle(p3.Width - width * 4 + 1, p3.Height - height + 1, (int)sf.Width - 2, height - 4));
}
}
@ -1374,6 +1380,8 @@ namespace Sunny.UI
if (ShowToday && e.Location.Y > p3.Height - height && e.Location.X > p3.Width - width * 4)
{
date = DateTime.Now.Date;
DoValueChanged(this, Date);
Close();
}
date = new DateTime(date.Year, date.Month, date.Day, Hour, Minute, Second);

View File

@ -24,6 +24,7 @@
* 2023-05-14: V3.3.6
* 2023-05-14: V3.3.6
* 2024-06-09: V3.6.6 2
* 2024-07-13: V3.6.7
******************************************************************************/
using System;

View File

@ -22,6 +22,7 @@
* 2020-09-16: V2.2.7
* 2021-04-15: V3.0.3 ShowToday显示今日属性
* 2024-06-09: V3.6.6 2
* 2024-07-13: V3.6.7
******************************************************************************/
using System;