/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:C_Button.cs
* 2.功能描述:扩展的按钮控件:便于修改背景颜色及字体、颜色
* 编辑履历:
* 作者 日期 版本 修改内容
* 陈晓野 2014/08/13 1.00 新建
*******************************************************************************/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Dongke.IBOSS.PRD.Basics.BaseControls
{
///
/// 扩展的按钮控件
///
public partial class C_Button : DKButton
{
#region 构造函数
public C_Button()
{
InitializeComponent();
this.ForeColor = Color.White;
if (this.Enabled)
{
this.BackgroundImage = imgButton.Images[0];
}
else
{
this.BackgroundImage = imgButton.Images[2];
}
this.BackgroundImageLayout = ImageLayout.Tile;
}
#endregion
#region 重写鼠标事件及状态改变事件
///
/// 当鼠标进入控件范围时触发,改变控件颜色
///
///
protected override void OnMouseEnter(EventArgs e)
{
if (this.Enabled)
{
this.BackgroundImage = imgButton.Images[1];
}
this.BackgroundImageLayout = ImageLayout.Tile;
base.OnMouseEnter(e);
}
///
/// 当鼠标离开控件范围时触发,改变控件颜色
///
///
protected override void OnMouseLeave(EventArgs e)
{
if (this.Enabled)
{
this.BackgroundImage = imgButton.Images[0];
}
this.BackgroundImageLayout = ImageLayout.Tile;
base.OnMouseLeave(e);
}
///
/// 当控件的Enable属性发生变化时触发,改变控件的背景颜色
///
///
protected override void OnEnabledChanged(EventArgs e)
{
if (!this.Enabled)
{
this.BackgroundImage = imgButton.Images[2];
}
else
{
this.BackgroundImage = imgButton.Images[0];
}
this.BackgroundImageLayout = ImageLayout.Tile;
base.OnEnabledChanged(e);
}
#endregion
}
}