ab56a9bcf7
SVN-Revision: r240
214 lines
6.7 KiB
C#
214 lines
6.7 KiB
C#
/******************************
|
|
* 说明:自定义子系统模块
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-08-13
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
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.Control;
|
|
using Lskj.Data;
|
|
using Lskj.Business.Impl;
|
|
|
|
namespace Lskj.Main4.Control
|
|
{
|
|
/// <summary>
|
|
/// 自定义子系统模块
|
|
/// </summary>
|
|
public partial class SubItem : UserControl
|
|
{
|
|
/// <summary>
|
|
/// 鼠标划过颜色
|
|
/// </summary>
|
|
private string _moveColor = "#eac205";
|
|
/// <summary>
|
|
/// 默认颜色
|
|
/// </summary>
|
|
public string DefaultColor;
|
|
/// <summary>
|
|
/// 是否可用
|
|
/// </summary>
|
|
public Boolean IsUsed;
|
|
/// <summary>
|
|
/// 模块名称
|
|
/// </summary>
|
|
public string SubName;
|
|
|
|
public SubItem()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private HoverEventHandler _hoverEvent = null;
|
|
/// <summary>
|
|
/// 鼠标划过控件
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void HoverEventHandler(SubItem sender);
|
|
|
|
private MouseClickEventHanlder _clickEvent = null;
|
|
/// <summary>
|
|
/// 鼠标点击控件
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void MouseClickEventHanlder(SubItem sender);
|
|
|
|
/// <summary>
|
|
/// label对象
|
|
/// </summary>
|
|
public Label GetLabel { get { return lblTitle; } }
|
|
/// <summary>
|
|
/// PictureBox对象
|
|
/// </summary>
|
|
public PictureBox GetPictureBox { get { return picImage; } }
|
|
/// <summary>
|
|
/// <para>说明:注册鼠标划过事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="hoverEvent">The hover event.</param>
|
|
public void SetHoverEvent(HoverEventHandler hoverEvent)
|
|
{
|
|
try
|
|
{
|
|
this._hoverEvent = hoverEvent;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:注册点击事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="clickEvent">The click event.</param>
|
|
public void SetClickEvent(MouseClickEventHanlder clickEvent)
|
|
{
|
|
try
|
|
{
|
|
this._clickEvent = clickEvent;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
#region 改变背景色
|
|
/// <summary>
|
|
/// <para>说明:鼠标移动时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
|
|
private void plTop_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.BackColor = ColorTranslator.FromHtml(_moveColor);
|
|
this.Cursor = Cursors.Hand;
|
|
if (_hoverEvent != null)
|
|
{
|
|
this._hoverEvent(this);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:鼠标离开时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void plCenter_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.BackColor = ColorTranslator.FromHtml(DefaultColor);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 点击事件
|
|
/// <summary>
|
|
/// <para>说明:鼠标点击时:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
|
|
private void plTop_MouseClick(object sender, MouseEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (_clickEvent != null)
|
|
{
|
|
if (IsUsed)
|
|
{
|
|
_clickEvent(this);
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(SubName + ResourceKeys.SubSystemUnEnabled);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
}
|