HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-12-14 e90209beae6a4e822cecb18e6889f8bda23f630e
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs
old mode 100755 new mode 100644
@@ -1,93 +1,93 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 做成一个模拟RowLayout,进行输入的FrameLayout控件(左边有标题)
    /// </summary>
    public class FrameCaptionInputControl : FrameRowControl
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 输入框的值
        /// </summary>
        public string Text
        {
            get { return txtInput.Text.Trim(); }
            set { txtInput.Text = value; }
        }
        /// <summary>
        /// 输入框控件(取值或者获取值可以使用【Text】属性,虽然这个也可以取)
        /// </summary>
        public TextInputControl txtInput = null;
        /// <summary>
        /// 标题控件
        /// </summary>
        public NormalViewControl btnCaption = null;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 做成一个模拟RowLayout,进行输入的FrameLayout控件(左边有标题)
        /// </summary>
        /// <param name="i_caption">标题文本</param>
        /// <param name="i_text">输入框的值</param>
        /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param>
        public FrameCaptionInputControl(string i_caption, string i_text, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
        {
            this.UseClickStatu = false;
            btnCaption = new NormalViewControl(270, 58, true);
            btnCaption.X = ControlCommonResourse.XXLeft;
            btnCaption.Gravity = Gravity.CenterVertical;
            btnCaption.Text = i_caption + ":";
            txtInput = new TextInputControl(700, true);
            txtInput.UseFocusColor = true;
            txtInput.X = Application.GetRealWidth(294);
            txtInput.Gravity = Gravity.CenterVertical;
            txtInput.Text = i_text;
        }
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="caption">标题</param>
        /// <param name="text">文本框的值</param>
        public void InitControl()
        {
            this.AddChidren(btnCaption, ChidrenBindMode.NotBind);
            this.AddChidren(txtInput, ChidrenBindMode.NotBind);
            if (chidrenYaxis != 0)
            {
                btnCaption.Y += chidrenYaxis;
                txtInput.Y += chidrenYaxis;
            }
        }
        #endregion
        #region ■ 添加底线___________________________
        /// <summary>
        /// <para>添加底线(如果左边有图标,则先添加图标,再添加底线)</para>
        /// <para>它的长度为:当前控件宽度-左右固定间距-左边图片宽度(如果有)-右边的偏移量</para>
        /// </summary>
        public override NormalViewControl AddBottomLine()
        {
            var btnLine = base.AddBottomLine();
            //联动线的状态
            txtInput.btnLine = btnLine;
            return btnLine;
        }
        #endregion
    }
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 做成一个模拟RowLayout,进行输入的FrameLayout控件(左边有标题)
    /// </summary>
    public class FrameCaptionInputControl : FrameRowControl
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 输入框的值
        /// </summary>
        public string Text
        {
            get { return txtInput.Text.Trim(); }
            set { txtInput.Text = value; }
        }
        /// <summary>
        /// 输入框控件(取值或者获取值可以使用【Text】属性,虽然这个也可以取)
        /// </summary>
        public TextInputControl txtInput = null;
        /// <summary>
        /// 标题控件
        /// </summary>
        public NormalViewControl btnCaption = null;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 做成一个模拟RowLayout,进行输入的FrameLayout控件(左边有标题)
        /// </summary>
        /// <param name="i_caption">标题文本</param>
        /// <param name="i_text">输入框的值</param>
        /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param>
        public FrameCaptionInputControl(string i_caption, string i_text, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
        {
            this.UseClickStatu = false;
            btnCaption = new NormalViewControl(270, 58, true);
            btnCaption.X = ControlCommonResourse.XXLeft;
            btnCaption.Gravity = Gravity.CenterVertical;
            btnCaption.Text = i_caption + ":";
            txtInput = new TextInputControl(700, true);
            txtInput.UseFocusColor = true;
            txtInput.X = Application.GetRealWidth(294);
            txtInput.Gravity = Gravity.CenterVertical;
            txtInput.Text = i_text;
        }
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="caption">标题</param>
        /// <param name="text">文本框的值</param>
        public void InitControl()
        {
            this.AddChidren(btnCaption, ChidrenBindMode.NotBind);
            this.AddChidren(txtInput, ChidrenBindMode.NotBind);
            if (chidrenYaxis != 0)
            {
                btnCaption.Y += chidrenYaxis;
                txtInput.Y += chidrenYaxis;
            }
        }
        #endregion
        #region ■ 添加底线___________________________
        /// <summary>
        /// <para>添加底线(如果左边有图标,则先添加图标,再添加底线)</para>
        /// <para>它的长度为:当前控件宽度-左右固定间距-左边图片宽度(如果有)-右边的偏移量</para>
        /// </summary>
        public override NormalViewControl AddBottomLine()
        {
            var btnLine = base.AddBottomLine();
            //联动线的状态
            txtInput.btnLine = btnLine;
            return btnLine;
        }
        #endregion
    }
}