Files
lserp_cs_6.0/插件库/Lskj.SweepCode/Control/SweepButton.cs
T
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

129 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lskj.Util;
using Lskj.Business.Impl;
using Lskj.Control;
namespace Lskj.SweepCode.Control
{
public partial class SweepButton : UserControl
{
public SweepButton()
{
InitializeComponent();
}
/// <summary>
/// 是否可用
/// </summary>
/// <value>The title label object.</value>
public bool isEnable;
// <summary>
/// 默认颜色
/// </summary>
/// <value>The title label object.</value>
public Color emptyColor;
/// <summary>
/// 标题对象
/// </summary>
/// <value>The title label object.</value>
public Label TitleLabelObj { get { return btn_title; } }
/// <summary>
/// 按钮点击
/// </summary>
/// <value>The title label object.</value>
public event EventHandler OnClick;
/// <summary>
/// 鼠标划过控件
/// </summary>
/// <param name="sender">The sender.</param>
public event EventHandler OnHover;
/// <summary>
/// 鼠标离开控件
/// </summary>
/// <param name="sender">The sender.</param>
public event EventHandler OnLeave;
/// <summary>
/// 字体大小
/// </summary>
/// <value>The size of the control.</value>
public int FontSize
{
get
{
return FontSize;
}
set
{
if (value > 0)
{
this.btn_title.Font = new Font(this.btn_title.Font.FontFamily, value, this.btn_title.Font.Style);
}
}
}
/// <summary>
/// 点击事件模拟
/// </summary>
/// <value>The title label object.</value>
public void OnClickCallBack()
{
if (OnClick != null)
{
OnClick(this, null);
}
}
private void btn_title_Click(object sender, EventArgs e)
{
OnClickCallBack();
}
public void OnMouseMove()
{
if (OnHover != null)
{
OnHover(this, null);
}
}
private void btn_title_MouseMove(object sender, MouseEventArgs e)
{
try
{
OnMouseMove();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
public void OnMouseLeave()
{
if (OnLeave != null)
{
OnLeave(this, null);
}
}
private void btn_title_MouseLeave(object sender, EventArgs e)
{
try
{
OnMouseLeave();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
}
}