* UIDatePicker: 修改选择日期在下拉框中显示方式
* UIDatetimePicker: 修改选择日期在下拉框中显示方式
This commit is contained in:
parent
759f6f0901
commit
17adb334bf
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user