ab56a9bcf7
SVN-Revision: r240
167 lines
5.0 KiB
C#
167 lines
5.0 KiB
C#
/******************************
|
|
* 说明:自定义皮肤选择控件
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-09-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 DevExpress.LookAndFeel;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control;
|
|
|
|
namespace Lskj.Main.Control
|
|
{
|
|
/// <summary>
|
|
/// 自定义皮肤选择控件
|
|
/// </summary>
|
|
public partial class SkinItem : UserControl
|
|
{
|
|
/// <summary>
|
|
/// Occurs when [on skin item click].
|
|
/// </summary>
|
|
[Description("设置皮肤点击事件")]
|
|
public event EventHandler OnSkinItemClick;
|
|
|
|
public SkinItem()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the skin image.
|
|
/// </summary>
|
|
/// <value>The skin image.</value>
|
|
[Description("设置皮肤图标"), Category("皮肤"), DefaultValue(null)]
|
|
public Image SkinImage
|
|
{
|
|
get
|
|
{
|
|
return btn_item_img.BackgroundImage;
|
|
}
|
|
set
|
|
{
|
|
btn_item_img.BackgroundImage = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Gets or sets the skin text.
|
|
/// </summary>
|
|
/// <value>The skin text.</value>
|
|
[Description("设置皮肤文本"), Category("皮肤"), DefaultValue("")]
|
|
public string SkinText
|
|
{
|
|
get
|
|
{
|
|
return btn_item_title.Text;
|
|
}
|
|
set
|
|
{
|
|
btn_item_title.Text = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Gets or sets the skin tag.
|
|
/// </summary>
|
|
/// <value>The skin tag.</value>
|
|
[Description("设置皮肤Tag"), Category("皮肤"), DefaultValue("")]
|
|
public string SkinTag
|
|
{
|
|
get
|
|
{
|
|
return btn_item_title.Tag + "";
|
|
}
|
|
set
|
|
{
|
|
btn_item_title.Tag = value + "";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:鼠标移动时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-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 SkinItem_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.BackColor = Color.FromArgb(205, 230, 247);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:鼠标离开时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-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 SkinItem_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.BackColor = Color.Transparent;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:切换皮肤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-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 SkinItem_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string skinName = this.btn_item_title.Tag + "";
|
|
|
|
UserLookAndFeel.Default.SetSkinStyle(skinName);
|
|
if (this.OnSkinItemClick != null)
|
|
OnSkinItemClick(skinName, e);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|