黄学彪
2019-12-02 4c40f503acf2bcf90d294cc439ef46ba259b9c60
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs
@@ -35,6 +35,14 @@
        /// 控件的点击事件(此事件被认可为执行按钮按下事件,受CanClick属性控制)
        /// </summary>
        public Action<Button, MouseEventArgs> ButtonClickEvent = null;
        /// <summary>
        /// 底部阴影控件1
        /// </summary>
        private Button btnBottomShadowView1 = null;
        /// <summary>
        /// 底部阴影控件2
        /// </summary>
        private Button btnBottomShadowView2 = null;
        #endregion
@@ -133,13 +141,11 @@
                }
                catch (Exception ex)
                {
                    //出现未知错误,数据丢失
                    var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost));
                    //出现未知错误
                    var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
                    alert.Show();
                    //Log出力
                    string msg = ex.Message + "\r\n";
                    msg += ex.TargetSite.ToString();
                    HdlLogLogic.Current.WriteLog(-1, msg);
                    HdlLogLogic.Current.WriteLog(ex);
                }
            }
        }
@@ -220,30 +226,19 @@
            int byteLength = 0;
            for (int i = 0; i < i_text.Length; i++)
            {
                int length = Encoding.UTF8.GetBytes(i_text[i].ToString()).Length;
                if (length == 1)
                {
                    //英文
                    byteLength += length;
                    continue;
                }
                //中文(暂时用中文对应)
                byteLength += Encoding.GetEncoding("gb2312").GetBytes(i_text[i].ToString()).Length;
                byteLength += Encoding.UTF8.GetBytes(i_text[i].ToString()).Length;
                //int length = Encoding.UTF8.GetBytes(i_text[i].ToString()).Length;
                //if (length == 1)
                //{
                //    //英文
                //    byteLength += length;
                //    continue;
                //}
                ////中文(暂时用中文对应)
                //byteLength += Encoding.GetEncoding("gb2312").GetBytes(i_text[i].ToString()).Length;
            }
            int realWidth = byteLength * (int)textSize;
            return Application.GetRealWidth(realWidth);
        }
        /// <summary>
        /// 添加底部阴影特效(确保拥有父控件后才调用)
        /// </summary>
        public void AddBottomShadow()
        {
            var btnShadow = new PicViewControl(this.Width, Application.GetMinRealAverage(45), false);
            btnShadow.X = this.X;
            btnShadow.Y = this.Bottom - 1;
            btnShadow.UnSelectedImagePath = "Item/BottomShadow.png";
            this.Parent.AddChidren(btnShadow);
            return Application.GetRealWidth(realWidth + 20);
        }
        #endregion