using Shared;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace HDL_ON.Stan
|
{
|
/// <summary>
|
/// FrameLayout的最初原型
|
/// </summary>
|
public class FrameLayoutBase : FrameLayout
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 设置能否触点击事件
|
/// </summary>
|
public bool CanClick = true;
|
/// <summary>
|
/// 声明此变量,旨在子线程也能够去获取一个控件的主键
|
/// </summary>
|
public string MainKey = string.Empty;
|
/// <summary>
|
/// 控件的点击事件(自定义封装事件,此事件被认可为执行按钮按下事件,受CanClick属性控制)
|
/// </summary>
|
public Action<object, MouseEventArgs> ButtonClickEvent = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// FrameLayout的最初原型
|
/// </summary>
|
public FrameLayoutBase()
|
{
|
//点击事件
|
this.MouseUpEventHandler += ButtonBase_MouseUpEventHandler;
|
}
|
|
#endregion
|
|
#region ■ 点击事件___________________________
|
|
/// <summary>
|
/// 点击事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void ButtonBase_MouseUpEventHandler(object sender, MouseEventArgs e)
|
{
|
if (ButtonClickEvent == null)
|
{
|
this.MouseUpEventHandler -= ButtonBase_MouseUpEventHandler;
|
return;
|
}
|
if (CanClick == true)
|
{
|
try
|
{
|
this.ButtonClickEvent(this, e);
|
}
|
catch (Exception ex)
|
{
|
//出现未知错误
|
HdlMessageLogic.Current.ShowAppProgramIsError(ex);
|
}
|
}
|
}
|
|
#endregion
|
|
#region ■ 一般方法___________________________
|
|
/// <summary>
|
/// 计算图片的真实高宽度
|
/// </summary>
|
/// <param name="i_size"></param>
|
/// <returns></returns>
|
public int GetPictrueRealSize(int i_size)
|
{
|
return Application.GetRealWidth(i_size);
|
}
|
|
/// <summary>
|
/// 控件摧毁
|
/// </summary>
|
public override void RemoveFromParent()
|
{
|
ButtonClickEvent = null;
|
|
if (this.Parent != null)
|
{
|
base.RemoveFromParent();
|
}
|
}
|
|
/// <summary>
|
/// ☆☆移除全部控件☆☆
|
/// </summary>
|
public override void RemoveAll()
|
{
|
if (this.Parent != null)
|
{
|
base.RemoveAll();
|
}
|
}
|
|
#endregion
|
}
|
}
|