!6 UITimePicker添加鼠标滚轮选择时间

Merge pull request !6 from 炽水寒冰/master
This commit is contained in:
Sunny 2020-05-30 21:07:42 +08:00 committed by Gitee
commit d672aa983e
5 changed files with 35 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,6 +53,41 @@ namespace Sunny.UI
public UITimeItem()
{
InitializeComponent();
this.MouseWheel += UITimeItem_MouseWheel;
}
private void UITimeItem_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Delta < 0)
{
if (new Rectangle(hc.Location, hc.Size).Contains(e.X, e.Y))
{
h1_Click(null, null);
}
else if (new Rectangle(mc.Location, mc.Size).Contains(e.X, e.Y))
{
m1_Click(null, null);
}
else if (new Rectangle(sc.Location, sc.Size).Contains(e.X, e.Y))
{
s1_Click(null, null);
}
}
else if (e.Delta > 0)
{
if (new Rectangle(hc.Location, hc.Size).Contains(e.X, e.Y))
{
h2_Click(null, null);
}
else if (new Rectangle(mc.Location, mc.Size).Contains(e.X, e.Y))
{
m2_Click(null, null);
}
else if (new Rectangle(sc.Location, sc.Size).Contains(e.X, e.Y))
{
s2_Click(null, null);
}
}
}
private DateTime time;