using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
///
/// 控件的逻辑
///
public class HdlControlLogic
{
#region ■ 变量声明___________________________
///
/// 控件的逻辑
///
private static HdlControlLogic m_Current = null;
///
/// 控件的逻辑
///
public static HdlControlLogic Current
{
get
{
if (m_Current == null)
{
m_Current = new HdlControlLogic();
}
return m_Current;
}
}
#endregion
#region ■ 子控件的Y轴坐标____________________
///
/// 指定位置类型获取Rowlayout的子控件的Y轴坐标(请确保子控件不大于父容器)
///
/// 父控件的真实高度
/// 子控件的真实高度
/// 位置对齐方式
/// 上下间的空白间距,省略时,取行控件共通变量的值。设置为-1时,不计算空白间距
///
public int GetControlChidrenYaxis(int fatherCtrHeight, int ctrHeight, UViewAlignment alignment, int Space = 0)
{
if (Space < 0)
{
//不计算间距值
Space = 0;
}
if (alignment == UViewAlignment.Center)
{
return fatherCtrHeight / 2 - ctrHeight / 2;
}
else if (alignment == UViewAlignment.Top)
{
return (fatherCtrHeight / 2 - Space / 2) / 2 - ctrHeight / 2;
}
else
{
int top = fatherCtrHeight / 2 + Space / 2;
return top + (fatherCtrHeight - top) / 2 - ctrHeight / 2;
}
}
#endregion
#region ■ 计算图片真实大小___________________
///
/// 计算图片的真实高宽度
///
///
///
public int GetPictrueRealSize(int i_size)
{
return Application.GetRealWidth(i_size);
}
#endregion
}
}