C#仿QQ皮肤-DateTimePicker 控件实现
2010-07-15 13:13 苏飞 阅读(3601) 评论(1) 编辑 收藏 举报原文:http://www.sufeinet.com/thread-2094-1-1.html
大家还是先来看看效果吧
下面我们一起来看看是怎么样实现的
这个暂时实现的比较简单一些,我只是给他加了一个外衣,其它的基本没有动,就是现在看到的效果,点开之后是和系统是控件DateTimePicker一个样子,呵呵
所以我在这里就不在多说什么了,实现 的很不进如人意,我会慢慢更新的,在这里只是先把代码放在这里,大家感觉那里不合适的可以帮助我改动一下,感谢
1.怎么样实现的上图效果
代码
public void ResetBitmap()
{
this.NormalImage = Shared.NomalDrawButton;
this.MouseDownImage = Shared.MouseDownDrawButton;
this.MouseMoveImage = Shared.MouseMoveDrawButton;
}
protected override void OnValueChanged(EventArgs eventargs)
{
base.OnValueChanged(eventargs);
this.Invalidate();
} private void OverrideDropDown(Graphics g)
{
//if (!this.ShowUpDown)
//{
Rectangle rect = new Rectangle(this.Width - DropDownButtonWidth, 0, DropDownButtonWidth, this.Height);
//ControlPaint.DrawComboButton(g, rect, ButtonState.Flat);
//}
g.FillRectangle(new SolidBrush(Color.White), rect);
if (this.Enabled)
{
if (_mouseEnter)
{
g.DrawImage(this.MouseMoveImage, new Rectangle(this.Width - 20, 3, 16, 16));
}
else
{
g.DrawImage(this.NormalImage, new Rectangle(this.Width - 20, 3, 16, 16));
}
}
else
{
g.DrawImage(Shared.NotEnableDrawButton, new Rectangle(this.Width - 20, 3, 16, 16));
}
}
{
this.NormalImage = Shared.NomalDrawButton;
this.MouseDownImage = Shared.MouseDownDrawButton;
this.MouseMoveImage = Shared.MouseMoveDrawButton;
}
protected override void OnValueChanged(EventArgs eventargs)
{
base.OnValueChanged(eventargs);
this.Invalidate();
} private void OverrideDropDown(Graphics g)
{
//if (!this.ShowUpDown)
//{
Rectangle rect = new Rectangle(this.Width - DropDownButtonWidth, 0, DropDownButtonWidth, this.Height);
//ControlPaint.DrawComboButton(g, rect, ButtonState.Flat);
//}
g.FillRectangle(new SolidBrush(Color.White), rect);
if (this.Enabled)
{
if (_mouseEnter)
{
g.DrawImage(this.MouseMoveImage, new Rectangle(this.Width - 20, 3, 16, 16));
}
else
{
g.DrawImage(this.NormalImage, new Rectangle(this.Width - 20, 3, 16, 16));
}
}
else
{
g.DrawImage(Shared.NotEnableDrawButton, new Rectangle(this.Width - 20, 3, 16, 16));
}
}
2.时间和日期绘制
..................
3.几个常用事件的处理
..................
下面是程序所有代码
原文:http://www.sufeinet.com/thread-2094-1-1.html
本人的博客不再维护从2013年就不再维护了
需要我帮助的朋友请到我的个人论坛 http://www.sufeinet.com 进行讨论,感谢大家对我的支持!