Example #1
0
        public MusicList()
        {
            DuiBaseControl b = new DuiBaseControl();

            b.Size      = new Size(Width, 35);
            b.BackColor = Color.Transparent;
            DuiLabel l = new DuiLabel();

            l.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
            l.Location       = new Point(30, 8);
            l.AutoSize       = true;
            l.Font           = new Font("微软雅黑", 11F, FontStyle.Bold);
            l.ForeColor      = Color.White;
            l.Text           = "这个列表没有音乐哦\n您可以直接把音乐拖到这里来";
            l.Name           = "name";
            b.Controls.Add(l);
            b.Name      = "no";
            b.Visible   = false;
            no          = b;
            tx.Interval = 100;
            tx.Tick    += Tx_Tick;
            t.Interval  = 100;
            t.Tick     += T_Tick;
            t1.Interval = 500;
            t1.Tick    += T1_Tick;
            cs          = new System.Windows.Forms.Cursor(Properties.Resources.music_move.GetHicon());
            MouseMove  += MusicList_MouseMove;
        }
Example #2
0
        private void AlbumForm_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 100; i++)                   //添加列表项目
            {
                DuiPictureBox picBox = new DuiPictureBox(); //图片容器
                picBox.Size = new Size(120, 120);
                //picBox.BackColor = Color.Red;
                picBox.Location            = new Point(5, 5);
                picBox.MouseEnter         += picBox_MouseEnter;//绑定事件实现鼠标移入移出的边框变化效果
                picBox.MouseLeave         += picBox_MouseLeave;
                picBox.Borders.BottomWidth = 3;
                picBox.Borders.LeftWidth   = 3;
                picBox.Borders.RightWidth  = 3;
                picBox.Borders.TopWidth    = 3;
                picBox.Image    = pic;//设置图片
                picBox.SizeMode = PictureBoxSizeMode.StretchImage;

                DuiBaseControl item = new DuiBaseControl();//列表项目
                item.Size = new Size(130, 130);
                item.Top  = 10;
                item.Controls.Add(picBox);

                layeredListBox1.Items.Add(item);
            }
        }
        public bool addIsNull()
        {
            try
            {
                this.BackColor = Color.White;
                DuiBaseControl abaseControl = new DuiBaseControl();
                abaseControl.Size     = new Size(this.Width - 5, this.Height);
                abaseControl.Location = new Point(0, 0);
                abaseControl.Name     = "imgListBaseControl_backnull";
                Items.Add(abaseControl);
                //更新列表
                RefreshList();
                GC.Collect();
                //背景图
                DuiPictureBox dp = new DuiPictureBox();
                dp.Size                  = new Size(510, 109);
                dp.BackgroundImage       = Properties.Resources.bnull;
                dp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                dp.Name                  = "back_pnull";
                dp.Location              = new Point((this.Width - 5 - 510) / 2, (this.Height - 2 - 109) / 2);
                abaseControl.Controls.Add(dp);

                Items.Add(abaseControl);
                //更新列表
                RefreshList();
                GC.Collect();
                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("未搜索到内容,原因为:" + e.Message);
            }
        }
Example #4
0
        private void Dlbe_MouseEnter(object sender, DuiMouseEventArgs e)
        {
            skinLine_Update();
            DuiBaseControl lbbtn = sender as DuiBaseControl;
            string         vtag  = "";

            foreach (var vitem in lbbtn.Controls)
            {
                DuiLabel lb = vitem as DuiLabel;
                vtag = lb.Tag.ToString();
                if (lb.Name.Contains("ImageTypeName_"))
                {
                    lb.ForeColor = defaultColor;
                }
                else
                {
                    lb.BackColor = defaultColor;
                }
            }
            DuiBaseControl bControl = lbbtn.Parent as DuiBaseControl;

            foreach (var item in bControl.FindControl("ImageTypeGrid_" + vtag))
            {
                if (item is DuiBaseControl && item.Controls.Count > 0 && Panel_TypeMess.DUIControls.Count <= 0)
                {
                    DuiBaseControl newpm = new DuiBaseControl();
                    newpm.Size       = item.Size;
                    newpm.Visible    = true;
                    newpm.Location   = new Point(0, 0);
                    newpm.BackColor  = item.BackColor;
                    newpm.Borders    = item.Borders;
                    newpm.ShowBorder = item.ShowBorder;
                    foreach (var vitem in item.Controls)
                    {
                        if (vitem is DuiLabel)
                        {
                            DuiLabel dl = vitem as DuiLabel;
                            dl.Cursor      = Cursors.Hand;
                            dl.MouseEnter += dlTag_MouseEnter;
                            dl.MouseLeave += dlTag_MouseLeave;
                            newpm.Controls.Add(dl);
                        }
                    }
                    newpm.Dock = DockStyle.Fill;
                    Panel_TypeMess.DUIControls.Add(newpm);
                    Panel_TypeMess.Size     = item.Size;
                    Panel_TypeMess.Location = new Point(item.Location.X, layeredPanel_top.Height + Panel_Type.Height - 5);
                    Utils.AnimationControl.ShowControl(Panel_TypeMess, true, AnchorStyles.Right);
                }
            }
            Point ms = Control.MousePosition;

            x = ms.X;
            y = ms.Y;
            //NowNum = int.Parse(btn.Tag.ToString());
            //LoadSliderImg(NowNum);
            Panel_Type.Refresh();
        }
Example #5
0
        void picBox_MouseLeave(object sender, EventArgs e)
        {
            DuiBaseControl control = (DuiBaseControl)sender;

            control.Borders.BottomColor = Color.Empty;
            control.Borders.LeftColor   = Color.Empty;
            control.Borders.RightColor  = Color.Empty;
            control.Borders.TopColor    = Color.Empty;
        }
Example #6
0
        void picBox_MouseEnter(object sender, EventArgs e)
        {
            DuiBaseControl control = (DuiBaseControl)sender;

            control.Borders.BottomColor = Color.Blue;
            control.Borders.LeftColor   = Color.Blue;
            control.Borders.RightColor  = Color.Blue;
            control.Borders.TopColor    = Color.Blue;
        }
Example #7
0
        public void Initialize(DuiBaseControl control, string text)
        {
            control.MouseEnter += Control_MouseEnter;
            control.MouseLeave += Control_MouseLeave;
            DuiTooltipText l = new DuiTooltipText();

            l.Name    = control.Name;
            l.TipText = text;
            list.Add(l);
        }
Example #8
0
 public void UnInitialize(DuiBaseControl control)
 {
     control.MouseEnter -= Control_MouseEnter;
     control.MouseLeave -= Control_MouseLeave;
     foreach (DuiTooltipText d in list)
     {
         if (d.Name == control.Name)
         {
             list.Remove(d);
         }
     }
 }
Example #9
0
        public DuiBaseControl FindItemExByText(string listname, string text)
        {
            DuiBaseControl ix = null;

            foreach (DuiBaseControl i1 in Items)
            {
                if (i1.Tag.ToString() == listname && ((DuiLabel)i1.FindControl("lbl")[0]).Tag.ToString() == text)
                {
                    ix = i1;
                }
            }
            return(ix);
        }
Example #10
0
        public DuiBaseControl FindItemEx(string name, string listname)
        {
            DuiBaseControl ix = null;

            foreach (DuiBaseControl i1 in Items)
            {
                if (i1.Name == name && i1.Tag.ToString() == listname)
                {
                    ix = i1;
                }
            }
            return(ix);
        }
Example #11
0
        public DuiBaseControl FindItem(string a)
        {
            DuiBaseControl ix = null;

            foreach (DuiBaseControl i1 in Items)
            {
                if (i1.Name == a)
                {
                    ix = i1;
                }
            }
            return(ix);
        }
Example #12
0
        public DuiBaseControl FindGroupEx(string a)
        {
            DuiBaseControl ix = null;

            foreach (DuiBaseControl i in Items)
            {
                if (i.Name == a || i.Name == "list_" + a)
                {
                    ix = i;
                }
            }
            return(ix);
        }
Example #13
0
        private DuiBaseControl getThisBaseControl(LayeredPanel lp, string controlName)
        {
            DuiBaseControl cb = null;

            foreach (DuiBaseControl item in lp.DUIControls)
            {
                if (item.Name == controlName)
                {
                    cb = item;
                }
            }
            return(cb);
        }
Example #14
0
        /// <summary>
        /// 添加头像
        /// </summary>
        /// <param name="bitmap"></param>
        /// <param name="layout"></param>
        /// <param name="cursor"></param>
        /// <param name="size"></param>
        /// <param name="location"></param>
        /// <param name="isEven"></param>
        /// <returns></returns>
        public DuiBaseControl AddItemsHeadImgControll(Bitmap bitmap, ImageLayout layout, Cursor cursor, Size size,
                                                      Point location, bool isEven)
        {
            DuiBaseControl _baseControl = new DuiBaseControl();

            _baseControl.Size      = size;
            _baseControl.Cursor    = cursor;
            _baseControl.Location  = location;
            _baseControl.BackColor = Color.Transparent;
            //baseControl.BorderRender = new FilletBorderRender(6, 2, Color.DodgerBlue);
            _baseControl.BackgroundImage       = bitmap;
            _baseControl.BackgroundImageLayout = layout;
            return(_baseControl);
        }
Example #15
0
        public static void ShowControl(DuiBaseControl control, bool visible, AnchorStyles direction = AnchorStyles.None)
        {
            if (direction == AnchorStyles.None)
            {
                control.Visible = visible;
                return;
            }

            if (!visible)
            {
                if (tmrAnim != null)
                {
                    tmrAnim.Stop();
                }
                control.Visible = false;
            }
            else
            {
                InitTimer();

                if (AnimationDuiBaseControl.control != control && destSize.IsEmpty)
                {
                    destSize = new Size(control.Width, control.Height);
                }
                AnimationDuiBaseControl.control   = control;
                AnimationDuiBaseControl.direction = direction;
                switch (direction)
                {
                case AnchorStyles.Left:
                case AnchorStyles.Right:
                    if (direction == AnchorStyles.Left)
                    {
                        control.Left += control.Width;
                    }
                    control.Width = 0;
                    break;

                case AnchorStyles.Top:
                case AnchorStyles.Bottom:
                    if (direction == AnchorStyles.Top)
                    {
                        control.Top += control.Height;
                    }
                    control.Height = 0;
                    break;
                }
                control.Visible = true;
                tmrAnim.Start();
            }
        }
Example #16
0
        /// <summary>
        /// 图片列表失去焦点后的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Dp_MouseLeave(object sender, EventArgs e)
        {
            Point ms = Control.MousePosition;

            if (ms.Y != y || (ms.X != x))
            {
                DuiBaseControl dp    = null;
                string         strId = "";
                if (sender is DuiBaseControl)
                {
                    dp = sender as DuiBaseControl;
                    if (dp.Name.Contains("btnBaseControl_"))
                    {
                        strId = (dp != null ? dp.Name.Replace("btnBaseControl_", "") : "");
                    }
                }
                if (sender is DuiButton)
                {
                    dp    = (sender as DuiButton).Parent as DuiBaseControl;
                    strId = (sender as DuiButton).Name.Replace("btn_Download_", "").Replace("btn_Setting_", "");
                }
                if (sender is DuiPictureBox)
                {
                    strId = (sender as DuiPictureBox).Name.Replace("back_", "");
                    dp    = (sender as DuiPictureBox).Parent as DuiBaseControl;
                }
                //隐藏按钮
                if (dp.FindControl("btnBaseControl_" + strId).Count > 0)
                {
                    DuiBaseControl ldl = dp.FindControl("btnBaseControl_" + strId)[0];
                    if (!ldl.IsMouseEnter)
                    {
                        ldl.Visible = false;
                        //显示名称
                        if (dp.FindControl("imgTag_" + strId).Count > 0)
                        {
                            DuiLabel dl = (DuiLabel)dp.FindControl("imgTag_" + strId)[0];
                            dl.Visible = true;
                        }
                        //显示时长
                        if (dp.FindControl("tvLength_" + strId).Count > 0)
                        {
                            DuiLabel dl = (DuiLabel)dp.FindControl("tvLength_" + strId)[0];
                            dl.Visible = true;
                        }
                    }
                }
            }
        }
Example #17
0
        public static DuiBaseControl CreateBaseControl(string text, string name, int width, int height, Color backColor, Color borderColor)
        {
            DuiBaseControl item = new DuiBaseControl
            {
                BackColor  = backColor,
                Width      = width,
                Text       = text,
                Name       = name,
                Height     = height,
                ShowBorder = !borderColor.Equals(Color.Transparent)
            };

            item.Borders.AllColor = borderColor;
            return(item);
        }
Example #18
0
 private void moveto(DuiBaseControl s, int y)
 {
     moves = s;
     toy   = y;
     if (s.Top > y)
     {
         downing = true;
         tx.Start();
     }
     else
     {
         downing = false;
         tx.Start();
     }
 }
Example #19
0
        public static DuiBaseControl CreatePicture(DuiBaseControl baseItem, string name, string text, Point location, Size size, string bgImgName)
        {
            DuiBaseControl baseCtl = new DuiBaseControl
            {
                Location              = location,
                Size                  = size,
                Name                  = name,
                Text                  = text,
                BackgroundImage       = (Bitmap)Properties.Resources.ResourceManager.GetObject(bgImgName),
                BackgroundImageLayout = ImageLayout.Stretch,
                BackColor             = Color.Transparent,
            };

            baseItem.Controls.Add(baseCtl);
            return(baseCtl);
        }
Example #20
0
        /// <summary>
        /// 是否存在列表
        /// </summary>
        /// <param name="uin">QQ编号(非QQ号)</param>
        /// <returns></returns>
        public DuiBaseControl IsHaveItem(string uin)
        {
            DuiBaseControl dc = null;

            //for (int i = 0; i < ChatList.Items.Count; i++)
            //{
            //    object[] obj = (object[])ChatList.Items[i].Tag;
            //    TagFrirendInfo tagFrirendInfo = (TagFrirendInfo)obj[0];
            //    if (tagFrirendInfo.Uin == uin)
            //    {
            //        dc = ChatList.Items[i];
            //        break;
            //    }
            //}
            return(dc);
        }
        private DuiLabel CreateLabel(DuiBaseControl baseItem, Point location, Size size, string name, string text, int fontSize, string toolTip)
        {
            DuiLabel item = new DuiLabel
            {
                Location  = location,
                Size      = size,
                Name      = name,
                Text      = text,
                ForeColor = Color.Tan,
                BackColor = Color.Transparent,
                Font      = new Font("微软雅黑", fontSize),
                ToolTip   = toolTip,
                Cursor    = Cursors.Hand
            };

            item.MouseEnter += new EventHandler <MouseEventArgs>(delegate(object obj, MouseEventArgs args)
            {
                baseItem.BackColor = Color.FromArgb(50, 255, 255, 255);
            });
            item.MouseLeave += new EventHandler(delegate(object obj, EventArgs args)
            {
                baseItem.BackColor = Color.Transparent;
            });
            item.MouseClick += new EventHandler <DuiMouseEventArgs>(delegate(object obj, DuiMouseEventArgs args)
            {
                switch (name)
                {
                case "default":
                    SystemCommon.LoginState = LoginStateEnum.Default;
                    break;

                case "edit":
                    SystemCommon.LoginState = LoginStateEnum.Edit;
                    break;

                case "check":
                    SystemCommon.LoginState = LoginStateEnum.Check;
                    break;
                }
                if (this.SelectedHandler != null)
                {
                    this.SelectedHandler(SystemCommon.LoginState);
                }
            });
            baseItem.Controls.Add(item);
            return(item);
        }
Example #22
0
        /// <summary>
        /// 获取该分组下的用户项目
        /// </summary>
        /// <returns></returns>
        public List <UserItem> GetChildren()
        {
            List <UserItem> list   = new List <UserItem>();
            DuiBaseControl  parent = Parent as DuiBaseControl;

            if (parent != null)
            {
                foreach (DuiBaseControl item in parent.Controls)
                {
                    UserItem user = item as UserItem;
                    if (user != null && user.GroupId == Order)
                    {
                        list.Add(user);
                    }
                }
            }
            return(list);
        }
Example #23
0
        protected override void OnMouseClick(DuiMouseEventArgs e)
        {
            base.OnMouseClick(e);
            this.BackColor = selectedColor;
            DuiBaseControl parent = Parent as DuiBaseControl;

            if (parent != null)
            {
                foreach (DuiBaseControl item in parent.Controls)
                {
                    UserItem i = item as UserItem;
                    if (i != null && i != this)
                    {
                        i.BackColor = Color.Transparent;
                    }
                }
            }
        }
Example #24
0
        public static DuiLabel CreateLabel(DuiBaseControl baseItem, Point location, Size size, string name, string text, Color foreColor, Font font, Color borderColor, string toolTip)
        {
            DuiLabel label = new DuiLabel
            {
                Location   = location,
                Size       = size,
                Name       = name,
                Text       = text,
                ForeColor  = foreColor,
                Font       = font,
                BackColor  = Color.Transparent,
                ShowBorder = !borderColor.Equals(Color.Transparent),
                ToolTip    = toolTip
            };

            label.Borders.AllColor = borderColor;
            baseItem.Controls.Add(label);
            return(label);
        }
Example #25
0
        /// <summary>
        /// 图片列表获取焦点后的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Dp_MouseEnter(object sender, EventArgs e)
        {
            Point ms = Control.MousePosition;

            x = ms.X;
            y = ms.Y;
            DuiBaseControl dp    = null;
            string         strId = "";

            if (sender is DuiBaseControl)
            {
                dp = sender as DuiBaseControl;
            }
            if (sender is DuiButton)
            {
                dp    = (sender as DuiButton).Parent as DuiBaseControl;
                strId = (sender as DuiButton).Name.Replace("btn_Download_", "").Replace("btn_Setting_", "");
            }
            if (sender is DuiPictureBox)
            {
                strId = (sender as DuiPictureBox).Name.Replace("back_", "");
                dp    = (sender as DuiPictureBox).Parent as DuiBaseControl;
            }
            //隐藏标题
            if (dp.FindControl("imgTag_" + strId).Count > 0)
            {
                DuiLabel dl = (DuiLabel)dp.FindControl("imgTag_" + strId)[0];
                dl.Visible = false;
            }
            //隐藏时长
            if (dp.FindControl("tvLength_" + strId).Count > 0)
            {
                DuiLabel dl = (DuiLabel)dp.FindControl("tvLength_" + strId)[0];
                dl.Visible = false;
            }
            //显示按钮
            if (dp.FindControl("btnBaseControl_" + strId).Count > 0)
            {
                DuiBaseControl ldl = dp.FindControl("btnBaseControl_" + strId)[0];
                ldl.Visible = true;
            }
        }
        private void Init()
        {
            this.lboxState.Items.Clear();
            //默认
            DuiBaseControl defaultCtl = CreateBaseCtl("默认", "default");

            CreateLabel(defaultCtl, new Point(15, 5), new Size(this.lboxState.Width, 32), "default", "默认", 12, "");
            this.lboxState.Items.Add(defaultCtl);
            //编辑
            DuiBaseControl editCtl = CreateBaseCtl("编辑", "edit");

            CreateLabel(editCtl, new Point(15, 5), new Size(this.lboxState.Width, 32), "edit", "编辑", 12, "");
            this.lboxState.Items.Add(editCtl);

            //审核
            DuiBaseControl checkCtl = CreateBaseCtl("审核", "check");

            CreateLabel(checkCtl, new Point(15, 5), new Size(this.lboxState.Width, 32), "check", "审核", 12, "");
            this.lboxState.Items.Add(checkCtl);
        }
Example #27
0
        private void Listx_MouseUp(object sender, DuiMouseEventArgs e)
        {
            t1.Stop();
            moveing = false;
            //moveto(((DuiBaseControl)sender), oldtop);
            //System.Windows.Forms.MessageBox.Show(movec.ToString());
            if (movec > 25 || movec < -25)
            {
                int b = (int)(((double)movec - 12) / 25);
                int c = Math.Abs((int)(((double)movec - 12) / 25));
                //System.Windows.Forms.MessageBox.Show(c.ToString());
                int d = (Items.IndexOf((DuiBaseControl)sender) + b + 1);
                //System.Windows.Forms.MessageBox.Show(d.ToString());
                if (d > 0 && d < Items.Count && c > 0)
                {
                    MusicListItem  m  = FindGroup(((DuiBaseControl)sender).Tag.ToString());
                    DuiBaseControl m2 = FindGroupEx(((DuiBaseControl)sender).Tag.ToString());
                    MusicItem      m1 = null;
                    foreach (MusicItem ic in m.musics)
                    {
                        if (ic.Path == ((DuiBaseControl)sender).Name || ic.URL == ((DuiBaseControl)sender).Name)
                        {
                            m1 = ic;
                        }
                    }
                    int f = m.musics.IndexOf(m1) + b + 1;
                    //System.Windows.Forms.MessageBox.Show(m.musics.IndexOf(m1)+"\n"+b+"\n" + f.ToString());
                    if (f > 0 && f < m.musics.Count)
                    {
                        DuiBaseControl m0 = (DuiBaseControl)sender;
                        Items.Remove(m0);
                        Items.Insert(d, m0);
                        RefreshList();

                        m.musics.Remove(m1);
                        m.musics.Insert(f, m1);
                    }
                }
            }
            Cursor = System.Windows.Forms.Cursors.Default;
        }
Example #28
0
        /// <summary>
        /// 添加热门标签
        /// </summary>
        /// <param name="tagsList">标签数组List</param>
        /// <param name="typeId">分类ID</param>
        /// <param name="index">当前顺序</param>
        /// <returns></returns>
        private DuiBaseControl addHotTagControl(Entity.TagsEntity.Root tagsList)
        {
            int            index        = ((typeControl.Controls.Count - 1) / 2);
            DuiBaseControl ltypeControl = new DuiBaseControl();

            if (tagsList.data.Count > 0)
            {
                ltypeControl.Size = new Size(154, 15 + tagsList.data.Count * 27 / 2);
            }
            else
            {
                ltypeControl.Size = new Size(154, 0);
            }

            ltypeControl.Name      = "ImageTypeGrid_0";
            ltypeControl.Location  = new Point(60 * index, 25);
            ltypeControl.Visible   = false;
            ltypeControl.BackColor = Color.White;//Color.FromArgb(defaultColor.R,defaultColor.G,defaultColor.B);
            int rowi = 1;
            int coli = 1;
            int ti   = 1;

            foreach (Entity.TagsEntity.DataItem citem in tagsList.data)
            {
                coli = (ti % 2 == 0 ? 2 : 1);
                rowi = (int)Math.Ceiling(((double)ti / 2));
                DuiLabel dlbea = new DuiLabel();
                dlbea.Size        = new Size(60, 20);
                dlbea.Text        = citem.Item;
                dlbea.Name        = "ImageTypeNameOther_" + citem.TopicId + citem.ItemOrder;
                dlbea.Location    = new Point(70 * (coli - 1), 10 + 24 * (rowi - 1));
                dlbea.Cursor      = System.Windows.Forms.Cursors.Hand;
                dlbea.TextAlign   = ContentAlignment.MiddleCenter;
                dlbea.Tag         = "0-" + citem.Item;
                dlbea.MouseClick += dlTag_MouseClick;
                ltypeControl.Controls.Add(dlbea);
                ti++;
            }
            return(ltypeControl);
        }
Example #29
0
        /// <summary>
        /// 添加新消息列表
        /// </summary>
        /// <param name="headimg"></param>
        /// <param name="uin"></param>
        /// <param name="nicname"></param>
        /// <param name="msg"></param>
        //public void AddItemsMsg(string uin, string type, string nicname, string msg)
        //{
        //    TagFrirendInfo tagFrirendInfo = null;
        //    try
        //    {
        //        tagFrirendInfo = (type == "1"
        //            ? GetObj(headimg, Webqq.GetFriendsInfomation(uin))
        //            : GetObj(headimg, Webqq.GetGroupInfomation(uin)));
        //    }
        //    catch
        //    {
        //        tagFrirendInfo = null;
        //    }
        //    if (tagFrirendInfo == null)
        //        return;
        //    FrmChat fc = FrmMain.FindFrmChat(uin, type);
        //    if (fc != null)
        //    {
        //        //fc.ReadChatRecord();
        //        return;
        //    }
        //    //判断是否存在列表中
        //    DuiBaseControl dc = IsHaveItem(tagFrirendInfo.Uin);
        //    if (dc != null)
        //    {
        //        ((DuiLabel)dc.Controls[3]).Text = (int.Parse(((DuiLabel)dc.Controls[3]).Text) + 1).ToString();
        //        ((DuiLabel)dc.Controls[1]).Text = msg;
        //    }
        //    else
        //    {
        //        DuiBaseControl item = AddChatItems(headimg, tagFrirendInfo.NicName, msg);
        //        //第一项为头像,第二项为QQ名称与个性签名,第三项为好友UIN(非QQ号),第四项为好友类型1为好友,2为群
        //        object[] obj = new object[10];
        //        obj[0] = tagFrirendInfo;
        //        obj[1] = type;
        //        item.Tag = obj;
        //        ChatList.Items.Add(item);
        //        ChatList.RefreshList();
        //        this.Height = ChatList.Items.Count * 55 + 80;
        //        this.Top = Screen.GetWorkingArea(this).Height - this.Height;
        //    }
        //}
        /// <summary>
        /// 添加新消息列表
        /// </summary>
        /// <param name="headimg"></param>
        /// <param name="uin"></param>
        /// <param name="nicname"></param>
        /// <param name="msg"></param>
        //public void AddItemsMsg(Bitmap headimg, string uin, string type, string nicname, List<MsgModel> msgModels)
        //{
        //    TagFrirendInfo tagFrirendInfo = null;
        //    try
        //    {
        //        tagFrirendInfo = (type == "1"
        //            ? GetObj(headimg, Webqq.GetFriendsInfomation(uin))
        //            : GetObj(headimg, Webqq.GetGroupInfomation(uin)));
        //    }
        //    catch
        //    {
        //        tagFrirendInfo = null;
        //    }
        //    if (tagFrirendInfo == null)
        //        return;
        //    FrmChat fc = FrmMain.FindFrmChat(uin, type);
        //    if (fc != null)
        //    {
        //        //fc.ReadChatRecord();
        //        return;
        //    }
        //    string lastMsg = "";
        //    if (msgModels.Count > 0)
        //    {
        //        if (msgModels[0].Type == "msg")
        //            lastMsg = msgModels[msgModels.Count - 1].Value;
        //        else if (msgModels[0].Type == "face")
        //            lastMsg = "[表情]";
        //        else if (msgModels[0].Type == "offpic")
        //            lastMsg = "[自定义图片]";
        //    }

        //    //判断是否存在列表中
        //    DuiBaseControl dc = IsHaveItem(tagFrirendInfo.Uin);
        //    if (dc != null)
        //    {
        //        ((DuiLabel)dc.Controls[3]).Text = (int.Parse(((DuiLabel)dc.Controls[3]).Text) + 1).ToString();
        //        ((DuiLabel)dc.Controls[1]).Text = lastMsg;
        //    }
        //    else
        //    {
        //        DuiBaseControl item = AddChatItems(headimg, tagFrirendInfo.NicName, lastMsg);
        //        //第一项为头像,第二项为QQ名称与个性签名,第三项为好友UIN(非QQ号),第四项为好友类型1为好友,2为群
        //        object[] obj = new object[10];
        //        obj[0] = tagFrirendInfo;
        //        obj[1] = type;
        //        item.Tag = obj;
        //        ChatList.Items.Add(item);
        //        ChatList.RefreshList();
        //        this.Height = ChatList.Items.Count * 55 + 80;
        //        this.Top = Screen.GetWorkingArea(this).Height - this.Height;
        //    }
        //}
        /// <summary>
        /// 添加列表项
        /// </summary>
        /// <param name="head"></param>
        /// <param name="displayname"></param>
        /// <param name="personalMsg"></param>
        /// <returns></returns>
        public DuiBaseControl AddChatItems(Bitmap head, string displayname, string personalMsg)
        {
            //好友名称
            DuiLabel lbl = AddDuiLabel(displayname, _font, new Size(ChatList.Width - 85, 20), new Point(60, 8),
                                       false);
            //消息
            DuiLabel info = AddDuiLabel(personalMsg, _font, new Size(ChatList.Width - 85, 20), new Point(59, 30),
                                        false);
            //消息数量
            DuiLabel infocount = AddDuiLabel("1", _font, new Size(20, 20), new Point(ChatList.Width - 50, 15),
                                             false);

            infocount.ForeColor    = Color.White;
            infocount.TextAlign    = ContentAlignment.MiddleCenter;
            infocount.BorderRender = new FilletBorderRender(12, 1, Color.FromArgb(245, 108, 11));
            infocount.BackColor    = Color.FromArgb(245, 108, 11);
            info.ForeColor         = Color.FromArgb(60, 60, 60);
            //好友头像
            DuiBaseControl pic = AddItemsHeadImgControll(head, ImageLayout.Stretch, Cursors.Default, new Size(45, 45),
                                                         new Point(5, 5), true);

            pic.BackColor = Color.BurlyWood;
            //好友项容器
            DuiBaseControl item = new DuiBaseControl();

            item.BackColor         = Color.Transparent;
            item.Width             = ChatList.Width;
            item.Height            = 55;
            item.MouseDoubleClick += ItemsMouseDoubleClick;
            item.MouseEnter       += ItemsMouseEnter;
            item.MouseLeave       += ItemsMouseLeave;
            item.Controls.Add(lbl);
            item.Controls.Add(info);
            item.Controls.Add(pic);
            item.Controls.Add(infocount);
            item.Name    = ChatList.Items.Count.ToString();
            item.Visible = true;
            return(item);
        }
Example #30
0
 public void SetIsPlayingAb(string name, Image i, string listname = "")
 {
     if (IsInList(name))
     {
         if (listname != "")
         {
             foreach (DuiBaseControl b in InnerDuiControl.FindControl(name))
             {
                 //System.Windows.Forms.MessageBox.Show(b.Tag.ToString());
                 if (b.Tag.ToString() == listname)
                 {
                     ((DuiPictureBox)b.FindControl("albumpic")[0]).BackgroundImage = i;
                 }
             }
         }
         else
         {
             DuiBaseControl b = InnerDuiControl.FindControl(name)[0];
             ((DuiPictureBox)b.FindControl("albumpic")[0]).BackgroundImage = i;
         }
     }
 }