95 lines
3.1 KiB
C#
95 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.ProductDynamic.Controls
|
|
{
|
|
public partial class ImageButton : UserControl
|
|
{
|
|
/// <summary>
|
|
/// this label控件
|
|
/// </summary>
|
|
private DevExpress.XtraEditors.LabelControl _imageLabel;
|
|
public DevExpress.XtraEditors.LabelControl ImageLabel
|
|
{
|
|
get
|
|
{
|
|
_imageLabel = this.imageLabel;
|
|
return _imageLabel;
|
|
}
|
|
set { _imageLabel = value; }
|
|
}
|
|
private DevExpress.XtraEditors.LabelControl _simpleButton;
|
|
/// <summary>
|
|
/// this simpleButton控件
|
|
/// </summary>
|
|
public DevExpress.XtraEditors.LabelControl SimpleButton
|
|
{
|
|
get
|
|
{
|
|
_simpleButton = this.simplebButton;
|
|
return _simpleButton;
|
|
}
|
|
set { _simpleButton = value; }
|
|
}
|
|
/// <summary>
|
|
/// 按钮模型
|
|
/// </summary>
|
|
public ProductDynamicBtnModel productDynamicBtnModel;
|
|
public ImageButton(DataRow row)
|
|
{
|
|
InitializeComponent();
|
|
productDynamicBtnModel = new ProductDynamicBtnModel(row);
|
|
this.Load += new EventHandler(OnImageButton_Load);
|
|
this.SimpleButton.MouseMove += new MouseEventHandler(OnSimpleButton_MouseMove);
|
|
this.simplebButton.MouseLeave += new EventHandler(OnSimplebButton_MouseLeave);
|
|
}
|
|
/// <summary>
|
|
/// 窗体加载时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnImageButton_Load(object sender, EventArgs e)
|
|
{
|
|
this.imageLabel.Width = this.Height;
|
|
this.simplebButton.BackColor = this.BackColor;
|
|
if (productDynamicBtnModel != null)
|
|
{
|
|
this.simplebButton.Text = productDynamicBtnModel.ProductName;
|
|
try
|
|
{
|
|
//this.imageLabel.Appearance.Image = productDynamicBtnModel.ProductPic;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 鼠标离开事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSimplebButton_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
DevExpress.XtraEditors.LabelControl labelBtn = (DevExpress.XtraEditors.LabelControl)sender;
|
|
labelBtn.BackColor = Color.Transparent;
|
|
}
|
|
/// <summary>
|
|
/// 鼠标滑过事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSimpleButton_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
DevExpress.XtraEditors.LabelControl labelBtn = (DevExpress.XtraEditors.LabelControl)sender;
|
|
labelBtn.BackColor = ColorTranslator.FromHtml("#eac205");
|
|
}
|
|
}
|
|
}
|