using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
///
/// 输入框控件的最初原型(不建议修改和直接使用):标准字体颜色,文字向左靠齐,14号字
///
public class TextInputBase : EditText
{
#region ■ 变量声明___________________________
///
/// 联动底线
///
private NormalViewControl btnLineTemp = null;
///
/// 联动底线(值输入之后,线的颜色会变)
///
public NormalViewControl btnLine
{
set
{
this.btnLineTemp = value;
//光标事件
this.FoucsChanged -= this.TxtCode_FoucsChangedEvent;
this.FoucsChanged += this.TxtCode_FoucsChangedEvent;
}
}
#endregion
#region ■ 初始化_____________________________
///
/// 输入框控件的最初原型(不建议修改和直接使用):标准字体颜色,文字向左靠齐,14号字
///
public TextInputBase()
{
//测试,全体输入框为14号字
this.TextSize = 14;
this.PlaceholderTextColor = UserCenterColor.Current.TextTipColor;
this.TextColor = UserCenterColor.Current.TextColor1;
this.TextAlignment = TextAlignment.CenterLeft;
}
///
/// 初始化控件大小(不以平均值进行真实数值计算)
///
/// 宽度
/// 高度
/// 是否计算真实值
public void InitSize(int i_Width, int i_Height, bool real = true)
{
if (real == true)
{
i_Width = Application.GetRealWidth(i_Width);
i_Height = Application.GetRealHeight(i_Height);
}
this.Height = i_Height;
this.Width = i_Width;
}
///
/// 初始化控件大小(不以平均值进行真实数值计算)
///
/// 宽度
/// 是否计算真实值
public void InitSize(int i_Width, bool real = true)
{
if (real == true)
{
i_Width = Application.GetRealWidth(i_Width);
}
this.Height = ControlCommonResourse.NormalControlHeight;
this.Width = i_Width;
}
///
/// 初始化控件大小(以平均值进行真实数值计算)
///
/// 宽度
/// 高度
/// 是否计算真实值
public void InitAvgSize(int i_Width, int i_Height, bool real = true)
{
if (real == true)
{
i_Width = Application.GetMinRealAverage(i_Width);
i_Height = Application.GetMinRealAverage(i_Height);
}
this.Height = i_Height;
this.Width = i_Width;
}
#endregion
#region ■ 事件_______________________________
///
/// 焦点变更事件
///
///
///
private void TxtCode_FoucsChangedEvent(object sender, FocusEventArgs e)
{
if (e.Focus == false)
{
if (btnLineTemp != null)
{
btnLineTemp.BackgroundColor = UserCenterColor.Current.ButtomLine;
}
}
else
{
if (btnLineTemp != null)
{
btnLineTemp.BackgroundColor = UserCenterColor.Current.TextFrameSelectColor;
}
}
}
#endregion
#region ■ 一般方法___________________________
///
/// Y轴重置(真实数值,没有父容器无效)
///
/// 上下对齐方式
/// 上下两部分的间距
public void ReSetYaxis(UViewAlignment alignment, int Space = 0)
{
if (this.Parent == null)
{
return;
}
//Y轴重置
this.Y = UserCenterLogic.GetControlChidrenYaxis(this.Parent.Height, this.Height, alignment, Space);
}
#endregion
}
}