예제 #1
0
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);

            SlidingBar bar = this.SlidingBars.Find(b => b.Expanded == true);

            if (bar != null)
            {
                this.bar_OnExpanded(bar);
            }
        }
예제 #2
0
        //显示用户窗口
        private void ShowUserBar()
        {
            SlidingBar bar = new SlidingBar("微风IM");


            //IList<UserGroup> resGroups = Common.TcpConn.SendReceiveObject<IList<UserGroup>>("GetGroup", "ResGroup", 5000, "GetGroup");

            ////获取所有用户ID 以及用户对应的组的组ID
            //IList<UserGroupIDContract> allUserGroupID = Common.TcpConn.SendReceiveObject<IList<UserGroupIDContract>>("GetUserGroupID", "ResUserGroupID", 5000, "100");

            ////根据用户组,初始化用户组字典
            //foreach (UserGroup group in resGroups)
            //{
            //    dicGroupUser.Add(group.Id, new List<string>());

            //}
            ////把用户,根据用户ID添加到字典中
            //foreach (UserGroupIDContract contract in allUserGroupID)
            //{
            //    if (dicGroupUser.ContainsKey(contract.GroupID))
            //    {
            //        dicGroupUser[contract.GroupID].Add(contract.SenderID);
            //    }
            //}
            ////实例化每一个用户组
            //foreach (UserGroup userGroup in resGroups)
            //{
            //    Group newGroup = new Group(userGroup.Id.ToString(), userGroup.GroupName);

            //    IList<string> lstUserID = dicGroupUser[userGroup.Id];


            //      foreach (string userID in lstUserID)
            //      {
            //          User currUser = Common.GetDicUser(userID);
            //          newGroup.Users.Add(currUser);
            //      }
            //      bar.AddGroup(newGroup);
            //}

            bar.Location = new System.Drawing.Point(0, 0);
            bar.Name     = "slidingBarContainer1";
            bar.Size     = new System.Drawing.Size(500, 500);
            bar.Dock     = DockStyle.Fill;
            bar.TabIndex = 50;

            this.Controls.Add(bar);
        }
예제 #3
0
        protected override void OnControlAdded(ControlEventArgs e)
        {
            base.OnControlAdded(e);

            this.SlidingBars[0].Expanded = true;

            SlidingBar bar = e.Control as SlidingBar;

            if (bar == null)
            {
                throw new Exception("只能添加 SlidingBar 控件");
            }

            bar.OnExpanded += new SlidingBar.ExpandedHandler(bar_OnExpanded);

            this.bar_OnExpanded(this.SlidingBars[0]);
        }
예제 #4
0
        void bar_OnExpanded(SlidingBar sender)
        {
            sender.Height = this.Height - (this.Controls.Count - 1) * 21 - 2;
            int top = 2;

            for (int i = 0; i < this.Controls.Count; i++)
            {
                SlidingBar bar = this.Controls[i] as SlidingBar;

                bar.Top = top;

                if (!bar.Equals(sender))
                {
                    bar.Expanded = false;
                    top         += 21;
                }
                else
                {
                    top += sender.Height;
                }
            }
        }