Beispiel #1
0
        public YScroll chatVScroll;    //滚动条
        #endregion

        public bool Kdown(Keys KeyCode)
        {
            if (KeyCode == Keys.Down)
            {
                int seb = SelectIndex;
                doha(seb); return(true);
            }
            else if (KeyCode == Keys.Up)
            {
                int seb = SelectIndex;
                upha(seb); return(true);
            }
            else if (KeyCode == Keys.Enter || KeyCode == Keys.Space)
            {
                DownListItem TitleItem = Items[SelectIndex];
                if (TitleItem != null)
                {
                    SelectItem = TitleItem;
                    if (TitleItem.Visible)
                    {
                        if (DownClick != null)
                        {
                            DownClick(TitleItem);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #2
0
        public void Tom(DownListItem its)
        {
            Rectangle rect = its.Bounds;
            int       tom  = chatVScroll.Bounds.Y + chatVScroll.Value;

            rect.Y -= tom;
            this.Invalidate(rect);
        }
Beispiel #3
0
 public void SetSvs(DownListItem TitleItem)
 {
     if (chatVScroll.ShouldBeDraw)
     {
         if (chatVScroll.Value + Height < TitleItem.Bounds.Y + 100)
         {
             chatVScroll.Value += 5;
         }
         else if (chatVScroll.Value > TitleItem.Bounds.Y - 100)
         {
             chatVScroll.Value -= 5;
         }
     }
 }
Beispiel #4
0
 public void SetSv(DownListItem TitleItem)
 {
     if (chatVScroll.ShouldBeDraw)
     {
         if (chatVScroll.Value + Height - 50 < TitleItem.Bounds.Y)
         {
             chatVScroll.Value = TitleItem.Bounds.Y;
         }
         else if (chatVScroll.Value > TitleItem.Bounds.Y)
         {
             chatVScroll.Value = TitleItem.Bounds.Y - 150;
         }
     }
 }
Beispiel #5
0
        void doha(int seb)
        {
            int bbqq = seb += 1;

            try
            {
                DownListItem TitleItem = Items[bbqq];
                while (TitleItem != null)
                {
                    if (TitleItem.Visible)
                    {
                        seb         = bbqq;
                        SelectIndex = TitleItem.Index;

                        SetSv(TitleItem);
                        foreach (DownListItem TitleItems in Items)
                        {
                            if (TitleItems.Select)
                            {
                                TitleItems.Select = false;
                                Tom(TitleItems);
                            }
                        }
                        if (!TitleItem.Select)
                        {
                            TitleItem.Select = true;
                            Tom(TitleItem);
                        }
                        break;
                    }
                    bbqq++;
                    TitleItem = Items[bbqq];
                }
            }
            catch { }
        }
Beispiel #6
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            Point m_ptMousePos = e.Location;

            //if (e.Button == MouseButtons.Left)
            //    chatVScroll.IsMouseDown = false;
            //base.OnMouseUp(e);

            if (e.Button == MouseButtons.Left)
            {
                MouseDownY  = -1;
                IsMouseDown = false;
                if (chatVScroll.IsMouseDown)
                {
                    chatVScroll.IsMouseDown = false;
                    //如果有滚动条 判断是否在滚动条类点击
                    if (chatVScroll.Bounds.Contains(m_ptMousePos))
                    {
                        //判断在滚动条那个位置点击
                        if (!chatVScroll.SliderBounds.Contains(m_ptMousePos))
                        {
                            chatVScroll.MoveSliderToLocation(m_ptMousePos.Y);
                        }
                        return;
                    }
                }
                else if (m_ptMousePos.X == old.X && m_ptMousePos.Y == old.Y)
                {
                    if (Items.Count > 0)
                    {
                        SelectItem = null;

                        for (int i = 0; i < Items.Count; i++)
                        {
                            DownListItem it = Items[i];
                            if (it.Visible)
                            {
                                Rectangle rect = it.Bounds;
                                int       tom  = chatVScroll.Bounds.Y + chatVScroll.Value;
                                rect.Y -= tom;
                                if (rect.Contains(m_ptMousePos))
                                {
                                    SelectIndex = i;
                                    SelectItem  = it;

                                    if (!it.Select)
                                    {
                                        it.Select = true;
                                        Invalidate(rect);
                                    }

                                    Rectangle rect1 = it.Btn1Bounds;
                                    rect1.Y -= tom;
                                    if (rect1.Contains(m_ptMousePos))
                                    {
                                        if (PlayClick != null)
                                        {
                                            PlayClick(it);
                                        }
                                    }
                                    else
                                    {
                                        Rectangle rect2 = it.Btn2Bounds;
                                        rect2.Y -= tom;
                                        if (rect2.Contains(m_ptMousePos))
                                        {
                                            if (MoreClick != null)
                                            {
                                                MoreClick(it);
                                            }
                                        }
                                        else
                                        {
                                            if (DownClick != null)
                                            {
                                                DownClick(it);
                                            }
                                        }
                                    }

                                    //break;
                                }
                                else
                                {
                                    if (it.Select)
                                    {
                                        it.Select = false;
                                        Invalidate(rect);
                                    }
                                }
                            }
                        }
                        if (SelectItem == null)
                        {
                            base.OnMouseUp(e);
                        }
                    }
                    else
                    {
                        base.OnMouseUp(e);
                    }
                }
                else
                {
                    base.OnMouseUp(e);
                }
            }
        }
Beispiel #7
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.Focus();
            Point m_ptMousePos = e.Location;

            if (e.Button == MouseButtons.Left)
            {
                MouseDownY  = e.Y;
                IsMouseDown = true;
                old         = m_ptMousePos;
                if (chatVScroll.Bounds.Contains(m_ptMousePos))
                {
                    chatVScroll.IsMouseDown = true;
                    chatVScroll.MouseDownY  = e.Y;
                    //if (chatVScroll.SliderBounds.Contains(m_ptMousePos))
                    //{
                    //}
                }
                else
                {
                    if (Items.Count > 0)
                    {
                        SelectItem = null;

                        for (int i = 0; i < Items.Count; i++)
                        {
                            DownListItem it = Items[i];

                            if (it.Visible)
                            {
                                Rectangle rect = it.Bounds;
                                int       tom  = chatVScroll.Bounds.Y + chatVScroll.Value;
                                rect.Y -= tom;
                                if (rect.Contains(m_ptMousePos))
                                {
                                    SelectIndex = i;
                                    SelectItem  = it;
                                    break;
                                }
                            }
                        }
                        if (SelectItem == null)
                        {
                            base.OnMouseDown(e);
                        }
                    }
                    else
                    {
                        base.OnMouseDown(e);
                    }
                }
            }
            else if (e.Button == MouseButtons.XButton1)
            {
                chatVScroll.Value += 50;
            }
            else if (e.Button == MouseButtons.XButton2)
            {
                chatVScroll.Value -= 50;
            }
        }