using Shared;
|
using HDL_ON.UI.CSS;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace HDL_ON.Stan
|
{
|
/// <summary>
|
/// 做成一个简单的选择控件
|
/// </summary>
|
public class NormalSelectControl : FrameRowControl
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 显示文本
|
/// </summary>
|
private string textValue = string.Empty;
|
/// <summary>
|
/// 下部显示文本
|
/// </summary>
|
private string textBottomValue = null;
|
/// <summary>
|
/// 文本控件
|
/// </summary>
|
private NormalViewControl btnText = null;
|
/// <summary>
|
/// 选择控件
|
/// </summary>
|
private MostRightIconControl btnSelect = null;
|
/// <summary>
|
/// 状态
|
/// </summary>
|
private StatuMode Statu = StatuMode.UnSelect;
|
/// <summary>
|
/// 是否处于选择状态
|
/// </summary>
|
public bool IsSelected
|
{
|
get { return Statu == StatuMode.Select; }
|
set
|
{
|
if (value == false)
|
{
|
this.SetUnselectStatu();
|
}
|
else
|
{
|
this.SetSelectStatu();
|
}
|
}
|
}
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 做成一个简单的选择控件
|
/// </summary>
|
/// <param name="i_text">显示文本</param>
|
/// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param>
|
public NormalSelectControl(string i_text, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
|
{
|
this.textValue = i_text;
|
}
|
|
/// <summary>
|
/// 做成一个简单的选择控件
|
/// </summary>
|
/// <param name="i_topText">上部显示文本</param>
|
/// <param name="i_bottomText">下部显示文本</param>
|
/// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param>
|
public NormalSelectControl(string i_topText, string i_bottomText, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
|
{
|
this.textValue = i_topText;
|
this.textBottomValue = i_bottomText;
|
}
|
|
/// <summary>
|
/// 初始化内部控件
|
/// </summary>
|
/// <param name="iconParh">左侧图标</param>
|
public void InitControl(string iconParh = "")
|
{
|
//图片
|
if (iconParh != "")
|
{
|
var btnIcon = this.AddLeftIcon(28);
|
btnIcon.UnSelectedImagePath = iconParh;
|
}
|
if (this.textBottomValue == null)
|
{
|
//显示文本
|
btnText = this.AddLeftCaption(this.textValue, 208);
|
btnText.TextColor = CSS_Color.FirstLevelTitleColor;
|
}
|
else
|
{
|
//显示文本
|
btnText = this.AddTopView(this.textValue, 208);
|
this.AddBottomView(this.textBottomValue, 208);
|
}
|
//选择控件
|
btnSelect = this.AddMostRightEmptyIcon(21, 21);
|
btnSelect.Visible = false;
|
btnSelect.UnSelectedImagePath = "Public/ChooseOnIcon.png";
|
}
|
|
#endregion
|
|
#region ■ 选择状态___________________________
|
|
/// <summary>
|
/// 设定选择状态
|
/// </summary>
|
private void SetSelectStatu()
|
{
|
if (Statu == StatuMode.Select)
|
{
|
return;
|
}
|
btnSelect.Visible = true;
|
//状态变更
|
Statu = StatuMode.Select ;
|
}
|
|
/// <summary>
|
/// 设置非选择状态
|
/// </summary>
|
private void SetUnselectStatu()
|
{
|
if (Statu == StatuMode.UnSelect)
|
{
|
return;
|
}
|
btnSelect.Visible = false;
|
//状态变更
|
Statu = StatuMode.UnSelect;
|
}
|
#endregion
|
}
|
}
|