ab56a9bcf7
SVN-Revision: r240
125 lines
4.2 KiB
C#
125 lines
4.2 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; }
|
|
}
|
|
/// <summary>
|
|
/// this numlabel控件
|
|
/// </summary>
|
|
private DevExpress.XtraEditors.LabelControl _numLabel;
|
|
public DevExpress.XtraEditors.LabelControl NumLabel
|
|
{
|
|
get
|
|
{
|
|
_numLabel = this.numLabel;
|
|
return _numLabel;
|
|
}
|
|
set { _numLabel = 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>
|
|
private Color emptyColor;
|
|
/// <summary>
|
|
/// 按钮模型
|
|
/// </summary>
|
|
public ProductDynamicBtnModel productDynamicBtnModel;
|
|
public DataRow focusedRow;
|
|
public ImageButton(DataRow row)
|
|
{
|
|
InitializeComponent();
|
|
productDynamicBtnModel = new ProductDynamicBtnModel(row);
|
|
this.focusedRow = row;
|
|
this.Load += new EventHandler(OnImageButton_Load);
|
|
this.simplebButton.MouseMove += new MouseEventHandler(OnSimpleButton_MouseMove);
|
|
this.simplebButton.MouseLeave += new EventHandler(OnSimplebButton_MouseLeave);
|
|
this.imageLabel.MouseMove += new MouseEventHandler(OnSimpleButton_MouseMove);
|
|
this.imageLabel.MouseLeave += new EventHandler(OnSimplebButton_MouseLeave);
|
|
this.numLabel.MouseMove += new MouseEventHandler(OnSimpleButton_MouseMove);
|
|
this.numLabel.MouseLeave += new EventHandler(OnSimplebButton_MouseLeave);
|
|
}
|
|
/// <summary>
|
|
/// 窗体加载时
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnImageButton_Load(object sender, EventArgs e)
|
|
{
|
|
this.emptyColor = this.BackColor;
|
|
this.imageLabel.Width = this.Height + 10;
|
|
if (productDynamicBtnModel != null)
|
|
{
|
|
this.simplebButton.Text = productDynamicBtnModel.ProductName;
|
|
this.numLabel.Text = productDynamicBtnModel.Amount;
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(productDynamicBtnModel.ProductPic))
|
|
{
|
|
Image image = Image.FromFile(Util.PubUtil.ProductDynamic + productDynamicBtnModel.ProductPic);
|
|
this.imageLabel.Appearance.Image = image;
|
|
}
|
|
else
|
|
{
|
|
this.imageLabel.Appearance.Image = global::Lskj.ProductDynamic.Properties.Resources.right;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 鼠标离开事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSimplebButton_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
this.BackColor = emptyColor;
|
|
}
|
|
/// <summary>
|
|
/// 鼠标滑过事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnSimpleButton_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
this.BackColor = ColorTranslator.FromHtml("#1872cd");
|
|
}
|
|
}
|
|
}
|