黄学彪
2020-04-28 e22fdb94322e6cec38e5e4a9aec13d431a133fde
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs
@@ -9,6 +9,28 @@
    /// </summary>
    public class TextInputBase : EditText
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 联动底线
        /// </summary>
        private NormalViewControl btnLineTemp = null;
        /// <summary>
        /// 联动底线(值输入之后,线的颜色会变)
        /// </summary>
        public NormalViewControl btnLine
        {
            set
            {
                this.btnLineTemp = value;
                //光标事件
                this.FoucsChanged -= this.TxtCode_FoucsChangedEvent;
                this.FoucsChanged += this.TxtCode_FoucsChangedEvent;
            }
        }
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
@@ -27,8 +49,8 @@
        /// <summary>
        /// 初始化控件大小(不以平均值进行真实数值计算)
        /// </summary>
        /// <param name="i_Width">宽度</param>
        /// <param name="i_Height">高度</param>
        /// <param name="i_Width">宽度</param>
        /// <param name="i_Height">高度</param>
        /// <param name="real">是否计算真实值</param>
        public void InitSize(int i_Width, int i_Height, bool real = true)
        {
@@ -36,44 +58,71 @@
            {
                i_Width = Application.GetRealWidth(i_Width);
                i_Height = Application.GetRealHeight(i_Height);
            }
            this.Height = i_Height;
            }
            this.Height = i_Height;
            this.Width = i_Width;
        }
        /// <summary>
        /// 初始化控件大小(不以平均值进行真实数值计算)
        /// </summary>
        /// <param name="i_Width">宽度</param>
        /// <param name="i_Width">宽度</param>
        /// <param name="real">是否计算真实值</param>
        public void InitSize(int i_Width, bool real = true)
        {
            if (real == true)
            {
                i_Width = Application.GetRealWidth(i_Width);
            }
            this.Height = ControlCommonResourse.NormalControlHeight;
            }
            this.Height = ControlCommonResourse.NormalControlHeight;
            this.Width = i_Width;
        }
        /// <summary>
        /// 初始化控件大小(以平均值进行真实数值计算)
        /// </summary>
        /// <param name="i_Width">宽度</param>
        /// <param name="i_Height">高度</param>
        /// <param name="i_Width">宽度</param>
        /// <param name="i_Height">高度</param>
        /// <param name="real">是否计算真实值</param>
        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;
                i_Width = this.GetPictrueRealSize(i_Width);
                i_Height = this.GetPictrueRealSize(i_Height);
            }
            this.Height = i_Height;
            this.Width = i_Width;
        }
        #endregion
        #region ■ 事件_______________________________
        /// <summary>
        /// 焦点变更事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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
@@ -92,8 +141,19 @@
                return;
            }
            //Y轴重置
            this.Y = UserCenterLogic.GetControlChidrenYaxis(this.Parent.Height, this.Height, alignment, Space);
            this.Y = HdlControlLogic.Current.GetControlChidrenYaxis(this.Parent.Height, this.Height, alignment, Space);
        }
        /// <summary>
        /// 计算图片的真实高宽度
        /// </summary>
        /// <param name="i_size"></param>
        /// <returns></returns>
        public int GetPictrueRealSize(int i_size)
        {
            return HdlControlLogic.Current.GetPictrueRealSize(i_size);
        }
        #endregion
    }
}