HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-12-30 3dcbd186c42c598c0c08d1cd37034cf2baa09e54
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs
@@ -40,20 +40,30 @@
        /// 做成一个存在于右上角的菜单控件
        /// </summary>
        /// <param name="i_RowCount">一共有几行(不含标题)</param>
        /// <param name="i_width">这个菜单有多宽</param>
        /// <param name="i_widthType">这个菜单的宽度模式,目前只支持
        /// <para>1: 395宽度</para>
        /// <para>2: 449宽度</para>
        /// </param>
        /// <param name="titleText">标题文本(如果不为空,菜单模式变更为拥有标题的模式)</param>
        public TopRightMenuControl(int i_RowCount, int i_width = 395, string titleText = null)
        public TopRightMenuControl(int i_RowCount, int i_widthType, string titleText = null)
        {
            this.RowCount = i_RowCount;
            this.RowWidth = i_width;
            if (i_widthType == 1)
            {
                this.RowWidth = 395;
            }
            else if (i_widthType == 2)
            {
                this.RowWidth = 449;
            }
            //初始化画面的控件
            this.InitFormControl(titleText);
            this.InitFormControl(titleText, i_widthType);
        }
        /// <summary>
        /// 初始化画面的控件
        /// </summary>
        private void InitFormControl(string titleText)
        private void InitFormControl(string titleText, int i_widthType)
        {
            this.BackgroundColor = UserCenterColor.Current.DialogBackColor;
            this.MouseUpEventHandler += (sender2, e2) =>
@@ -71,22 +81,24 @@
                //菜单+1
                rowCount++;
            }
            //桌布
            //背景
            var frameBack = new FrameLayout();
            frameBack.X = Application.GetRealWidth(662 - (RowWidth - 395));
            frameBack.Y = Application.GetRealHeight(161);
            frameBack.Width = Application.GetRealWidth(RowWidth);
            frameBack.Height = Application.GetRealHeight(RowHeight * rowCount + 16);
            frameBack.BackgroundImagePath = "MenuGroud/TopRightMenu" + i_widthType + "_" + rowCount + ".png";
            this.AddChidren(frameBack);
            var frameTable = new FrameLayout();
            frameTable.X = Application.GetRealWidth(662 - (RowWidth - 395));
            frameTable.Y = Application.GetRealHeight(158 + 15 + 1);
            frameTable.Width = Application.GetRealWidth(RowWidth);
            frameTable.Height = Application.GetRealHeight(RowHeight * rowCount);
            frameTable.BackgroundColor = UserCenterColor.Current.White;
            frameTable.BorderColor = UserCenterColor.Current.Transparent;
            frameTable.Radius = (uint)Application.GetRealHeight(17);
            this.AddChidren(frameTable);
            frameTable.Y = Application.GetRealHeight(16);
            frameBack.AddChidren(frameTable);
            if (titleText != null)
            {
                var btnTitle = new NormalViewControl(frameTable.Width - Application.GetRealWidth(81), Application.GetRealHeight(58), false);
                var btnTitle = new NormalViewControl(frameBack.Width - Application.GetRealWidth(81), Application.GetRealHeight(58), false);
                btnTitle.X = Application.GetRealWidth(81);
                btnTitle.Y = Application.GetRealHeight(58);
                btnTitle.Y = Application.GetRealHeight(58 + 16);
                btnTitle.Text = titleText;
                frameTable.AddChidren(btnTitle);
            }
@@ -106,13 +118,6 @@
            }
            listView.Radius = (uint)Application.GetRealHeight(17);
            frameTable.AddChidren(listView);
            //三角形图标
            var btnTriangle = new PicViewControl(31, 15);
            btnTriangle.X = Application.GetRealWidth(980);
            btnTriangle.Y = Application.GetRealHeight(159);
            btnTriangle.UnSelectedImagePath = "Item/UpperTriangle.png";
            this.AddChidren(btnTriangle);
        }
        #endregion