| | |
| | | }
|
| | | if (CanClick == true)
|
| | | {
|
| | | this.ButtonClickEvent?.Invoke(this, e);
|
| | | //Log出力
|
| | | this.WriteLog();
|
| | |
|
| | | try
|
| | | {
|
| | | this.ButtonClickEvent?.Invoke(this, e);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | //出现未知错误,数据丢失
|
| | | var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnknownErrorAndDataLost));
|
| | | alert.Show();
|
| | | //Log出力
|
| | | HdlLogLogic.Current.WriteLog(ex);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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);
|
| | | return Application.GetRealWidth(realWidth + 20);
|
| | | }
|
| | |
|
| | | /// <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);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ Log出力____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 该控件所属的界面名字
|
| | | /// </summary>
|
| | | private string formName = null;
|
| | | /// <summary>
|
| | | /// 控件名字
|
| | | /// </summary>
|
| | | private string controlName = null;
|
| | |
|
| | | /// <summary>
|
| | | /// Log出力
|
| | | /// </summary>
|
| | | private void WriteLog()
|
| | | {
|
| | | if (formName == null)
|
| | | {
|
| | | formName = string.Empty;
|
| | | View myView = this.Parent;
|
| | | for (; ; )
|
| | | {
|
| | | if (myView == null)
|
| | | {
|
| | | break;
|
| | | }
|
| | | else if (myView is CommonFormBase)
|
| | | {
|
| | | //这个控件所属的界面
|
| | | formName = ((CommonFormBase)myView).FormID;
|
| | | break;
|
| | | }
|
| | | myView = myView.Parent;
|
| | | }
|
| | | if (string.IsNullOrEmpty(this.Text) == false)
|
| | | {
|
| | | //这个控件的文本
|
| | | controlName = this.Text;
|
| | | }
|
| | | else
|
| | | {
|
| | | //如果没有文本的话,它应该是一张图片
|
| | | controlName = this.UnSelectedImagePath;
|
| | | }
|
| | | }
|
| | | HdlLogLogic.Current.WriteLog(1, formName + "的[" + controlName + "]按键被点击");
|
| | | }
|
| | |
|
| | | #endregion
|