예제 #1
0
        void doha(int seb)
        {
            int bbqq = seb += 1;

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

                    SetSv(TitleItem);
                    foreach (WebVideoListItem TitleItems in Items)
                    {
                        if (TitleItems.Select)
                        {
                            TitleItems.Select = false;
                            Tom(TitleItems);
                        }
                    }
                    if (!TitleItem.Select)
                    {
                        TitleItem.Select = true;
                        Tom(TitleItem);
                    }
                }
            }
            catch { }
        }
예제 #2
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)
            {
                WebVideoListItem TitleItem = Items[SelectIndex];
                if (TitleItem != null)
                {
                    SelectItem = TitleItem;
                    if (DownClick != null)
                    {
                        DownClick(TitleItem);
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #3
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.MouseDownY  = MouseDownY;
                    chatVScroll.IsMouseDown = true;
                    //if (chatVScroll.SliderBounds.Contains(m_ptMousePos))
                    //{
                    //}
                }
                else
                {
                    if (Items.Count > 0)
                    {
                        SelectItem = null;

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

                            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;
            }
        }
예제 #4
0
        public void Tom(WebVideoListItem its)
        {
            Rectangle rect = its.Bounds;
            int       tom  = chatVScroll.Bounds.Y + chatVScroll.Value;

            rect.Y -= tom;
            this.Invalidate(rect);
        }
예제 #5
0
 public void SetSvs(WebVideoListItem 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;
         }
     }
 }
예제 #6
0
 public void SetSv(WebVideoListItem 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;
         }
     }
 }
예제 #7
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 == old)
                {
                    if (Items.Count > 0)
                    {
                        SelectItem = null;

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

                            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);
                                }
                                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);
                }
            }
        }
예제 #8
0
        public void InPaint()
        {
            Tops = 0;

            if (Items.Count > 0 && Width > 0 && Height > 0)
            {
                int width     = Width;
                int MaxHeight = 0;
                int windth_zi = (int)Math.Floor((width * 1.0) / 212);
                int index     = 0;
                int _LRWidth  = (width - windth_zi * 212) / 2;
                int UseWidth  = _LRWidth;
                for (int i = 0; i < Items.Count; i++)
                {
                    WebVideoListItem it = Items[i];
                    it.Index = i;

                    if (index == windth_zi)
                    {
                        index     = 0;
                        UseWidth  = _LRWidth;
                        Tops     += MaxHeight + 6;
                        MaxHeight = 0;
                    }

                    index++;


                    if (it.Img == null)
                    {
                        it.Bounds = new Rectangle(UseWidth + ((212 - 180) / 2), Tops, 180, 220);
                        MaxHeight = Math.Max(MaxHeight, 220);
                    }
                    else
                    {
                        #region 转换图片大小
                        if (it.ImgSize.Height == 0)
                        {
                            Size   size = it.Img.Size;
                            double dbl = (size.Width * 1.0) / (size.Height * 1.0);
                            int    _width = (int)size.Width, _height = (int)size.Height;
                            int    swidth = _width, sheight = _height;
                            if (_width == _height)
                            {
                                //正方形
                                if (_width > 200)
                                {
                                    //图片过大
                                    swidth = sheight = 200;
                                }
                                else
                                {
                                    swidth = sheight = _width;
                                }
                            }
                            else if (_width > _height)
                            {
                                //横向图
                                if (_width > 200)
                                {
                                    //width = destWidth;
                                    //height = (destWidth * sourHeight) / sourWidth;
                                    //图片过大
                                    swidth  = 200;
                                    sheight = (int)((double)200 / dbl);
                                }
                            }
                            else
                            {
                                //纵向图
                                if (_height > 200)
                                {
                                    //图片过大
                                    sheight = 200;
                                    swidth  = (int)((double)200 * dbl);
                                }
                            }
                            if (swidth > 0 && sheight > 0)
                            {
                                it.ImgSize = new Size(swidth, sheight);
                            }
                        }
                        #endregion

                        it.Bounds = new Rectangle(UseWidth + ((212 - it.ImgSize.Width) / 2), Tops, it.ImgSize.Width, it.ImgSize.Height);
                        MaxHeight = Math.Max(MaxHeight, it.ImgSize.Height);
                    }

                    it.NameBound = new Rectangle(it.Bounds.X, it.Bounds.Y + it.Bounds.Height - 20, it.Bounds.Width, 20);

                    it.IsRender = true;

                    UseWidth += 212;
                }
                if (MaxHeight > 0)
                {
                    Tops += MaxHeight + 6;
                }
                //Invalidate(chatVScroll.Bounds);
            }
            chatVScroll.VirtualHeight = Tops;//绘制完成计算虚拟高度决定是否绘制滚动条
        }