黄学彪
2020-04-02 9904031f5291daaf56985146bb671f25e18ebbdf
ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs
@@ -24,6 +24,10 @@
        /// 房间名称控件
        /// </summary>
        private NormalViewControl btnRoomName = null;
        /// <summary>
        /// 房间名字的背景
        /// </summary>
        private NormalViewControl btnRoomNameBackGroud = null;
        #endregion
@@ -66,14 +70,29 @@
            frameBack.BackgroundColor = 0x33000000;
            this.AddChidren(picRoom, ChidrenBindMode.BindEventOnly);
            ////房间名字的背景
            //var btnRoomNameBackGroud = new NormalViewControl(Application.GetRealWidth(141), Application.GetRealHeight(84), false);
            //btnRoomNameBackGroud.X = Application.GetRealWidth(14);
            //btnRoomNameBackGroud.UnSelectedImagePath = "Room/RoomCardView_Name.png";
            //this.AddChidren(btnRoomNameBackGroud, ChidrenBindMode.BindEventOnly);
            ////房间名字
            //this.btnRoomName = new NormalViewControl(btnRoomNameBackGroud.Width, btnRoomNameBackGroud.Height, false);
            //btnRoomName.X = Application.GetRealWidth(14);
            //btnRoomName.TextSize = 12;
            //btnRoomName.IsBold = true;
            //btnRoomName.TextAlignment = TextAlignment.Center;
            //btnRoomName.TextColor = UserCenterColor.Current.White;
            //this.AddChidren(btnRoomName, ChidrenBindMode.BindEventOnly);
            //房间名字的背景
            var btnRoomNameBackGroud = new NormalViewControl(Application.GetRealWidth(141), Application.GetRealHeight(84), false);
            this.btnRoomNameBackGroud = new NormalViewControl(Application.GetRealWidth(141), Application.GetRealHeight(84), false);
            btnRoomNameBackGroud.X = Application.GetRealWidth(14);
            btnRoomNameBackGroud.UnSelectedImagePath = "Room/RoomCardView_Name.png";
            btnRoomNameBackGroud.BackgroundColor = 0x80000000;
            this.AddChidren(btnRoomNameBackGroud, ChidrenBindMode.BindEventOnly);
            //房间名字
            this.btnRoomName = new NormalViewControl(btnRoomNameBackGroud.Width, btnRoomNameBackGroud.Height, false);
            this.btnRoomName = new NormalViewControl(50, Application.GetRealHeight(84), false);
            btnRoomName.X = Application.GetRealWidth(14);
            btnRoomName.TextSize = 12;
            btnRoomName.IsBold = true;
@@ -99,15 +118,19 @@
            {
                //刷新名字
                btnRoomName.Text = room.Name;
                if (btnRoomName.GetRealWidthByText() > Application.GetRealWidth(141))
                int realWidth = btnRoomName.GetRealWidthByText() + Application.GetRealWidth(70);
                if (realWidth < Application.GetRealWidth(141))
                {
                    //字体长度超过
                    btnRoomName.TextAlignment = TextAlignment.CenterLeft;
                    realWidth = Application.GetRealWidth(141);
                }
                else
                else if (realWidth > Application.GetRealWidth(420))
                {
                    btnRoomName.TextAlignment = TextAlignment.Center;
                    realWidth = Application.GetRealWidth(420);
                }
                btnRoomName.Width = realWidth;
                btnRoomNameBackGroud.Width = realWidth;
                btnRoomNameBackGroud.SetCornerWithSameRadius(picRoom.Radius, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomRight);
                //刷新图片
                if (room.BackgroundImageType == 0)
                {