Exemple #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.TranslateTransform(0, -chatVScroll.Value);       //根据滚动条的值设置坐标偏移
            g.SmoothingMode     = SmoothingMode.HighQuality;   //使绘图质量最高,即消除锯齿
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.PixelOffsetMode   = PixelOffsetMode.HighQuality; //高像素偏移质量
            int toms = chatVScroll.Bounds.Y + chatVScroll.Value;
            int tom  = toms - 30;

            List <DownListItem> _Items = Items.FindAll(db => db.Visible && (db.Bounds.Y > tom && db.Bounds.Y - toms < Height));

            try
            {
                foreach (DownListItem it in _Items)
                {
                    if (_IsCheck)
                    {
                        g.DrawString(TPlayer.FontAwesome.GetUnicode(it.Check ? 20282 : 20283), onAS1, FontColor1, it.CheckBounds, _StringFormatC);
                    }

                    if (it.MouseHover)
                    {
                        g.FillRectangle(solidBrush, it.Bounds);
                    }
                    if (_PlayIndex == it.Index)
                    {
                        if (it.Btn1Bounds.X > 0 && it.Btn2Bounds.X > 0)
                        {
                            g.DrawString(TPlayer.FontAwesome.GetUnicode(_Playing ? "4FC4" : "4FBE"), onA, it.MouseHover1 ? solidBrushOk : FontColor1, it.Btn1Bounds, _StringFormatC);
                            g.DrawString(TPlayer.FontAwesome.GetUnicode("4FFC"), onA, it.MouseHover2 ? solidBrushOk : FontColor1, it.Btn2Bounds, _StringFormatC);
                        }

                        g.DrawString(it.Name, on, solidBrushOk, it.NameBound, _StringFormat);
                        g.DrawString(it.Desc, on2, solidBrushOk, it.DescBound, _StringFormat);
                    }
                    else
                    {
                        if (it.Enabled)
                        {
                            //g.DrawString(TPlayer.FontAwesome.GetUnicode(20230), onA, FontColor1, it.NameBound, _StringFormat);
                            //20414 播放
                            //20420 暂停
                            //20416 菜单
                            g.DrawString(it.Name, on, FontColor1, it.NameBound, _StringFormat);
                            g.DrawString(it.Desc, on2, FontColor2, it.DescBound, _StringFormat);
                        }
                        else
                        {
                            g.DrawString(it.Name, on, FontColor2, it.NameBound, _StringFormat);
                            g.DrawString(it.Desc, on2, FontColor2, it.DescBound, _StringFormat);
                        }
                    }
                    if (it.Select)
                    {
                        g.DrawRectangle(pen, it.Bound);
                        //g.FillRectangle(yllosolidBrush, it.Bounds);
                    }
                }
                g.ResetTransform();             //重置坐标系
                if (chatVScroll.ShouldBeDraw)   //是否绘制滚动条
                {
                    chatVScroll.ReDrawScroll(g);
                }
            }
            catch { }

            base.OnPaint(e);
        }
Exemple #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g_main = e.Graphics;

            g_main.SmoothingMode     = SmoothingMode.HighQuality;   //使绘图质量最高,即消除锯齿
            g_main.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g_main.PixelOffsetMode   = PixelOffsetMode.HighQuality; //高像素偏移质量

            Rectangle rect = this.ClientRectangle;

            using (Bitmap bitmap = new Bitmap(rect.Width, rect.Height + dimHeight))
            {
                int last  = chatVScroll.Bounds.Y + chatVScroll.Value;
                int first = last - (300 + dimHeight);

                List <WebVideoListItem> _Items = Items.FindAll(db => (db.Bounds.Y > first && db.Bounds.Y - last < rect.Height));

                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.TranslateTransform(0, -(chatVScroll.Value - dimHeight)); //根据滚动条的值设置坐标偏移
                    g.SmoothingMode     = SmoothingMode.HighQuality;           //使绘图质量最高,即消除锯齿
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
                    g.PixelOffsetMode   = PixelOffsetMode.HighQuality; //高像素偏移质量
                    foreach (WebVideoListItem it in _Items)
                    {
                        if (it.IsRender)
                        {
                            if (it.Img != null)
                            {
                                g.DrawImage(it.Img, it.Bounds);
                            }
                            else
                            {
                                g.FillRectangle(FontColor1, it.Bounds);
                                g.DrawString(FontAwesome.GetUnicode("51BC"), onA, FontColor2, it.Bounds, _StringFormatC);
                            }
                            g.FillRectangle(solidBrush3, it.NameBound);
                            g.DrawString(it.Name, on, FontColor1, it.NameBound, _StringFormat);

                            if (it.MouseHover)
                            {
                                g.FillRectangle(solidBrush, it.Bounds);
                                g.DrawString(FontAwesome.GetUnicode("518F"), onA, FontColor1, it.Bounds, _StringFormatC);
                            }

                            if (it.Select)
                            {
                                g.DrawRectangle(pen, it.Bound);
                                //g.FillRectangle(yllosolidBrush, it.Bounds);
                            }
                        }
                    }
                    //g.ResetTransform();//重置坐标系
                }
                //if (bitmapTop != null) {
                //    bitmapTop.Dispose();
                //}


                if (dimHeight > 0 && TopChange != null && _Items.Count > 0)
                {
                    Bitmap bitmapTop = new Bitmap(rect.Width, dimHeight);

                    Rectangle rectTop = new Rectangle(0, 0, rect.Width, dimHeight);
                    using (Graphics gTop = Graphics.FromImage(bitmapTop))
                    {
                        //gTop.SmoothingMode = SmoothingMode.AntiAlias;//使绘图质量最高,即消除锯齿
                        //gTop.InterpolationMode = InterpolationMode.HighQualityBicubic;
                        ////g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                        //gTop.PixelOffsetMode = PixelOffsetMode.HighQuality; //高像素偏移质量

                        gTop.DrawImage(bitmap, rectTop, rectTop, GraphicsUnit.Pixel);
                    }
                    //if (Bmp != null)
                    //{
                    //    Bmp.Dispose();
                    //    Marshal.FreeHGlobal(ImageCopyPointer);
                    //}


                    Rectangle Rect = new Rectangle(0, 0, bitmapTop.Width, bitmapTop.Height);
                    bitmapTop.GaussianBlur(ref Rect, 80, false);

                    using (Graphics gTop = Graphics.FromImage(bitmapTop))
                    {
                        gTop.FillRectangle(solidBrush2, rectTop);
                    }
                    //Bmp.UsmSharpen(ref Rect, BarRadius.Value, BarAmount.Value);
                    TopChange(bitmapTop);
                }

                g_main.DrawImage(bitmap, rect, new Rectangle(0, dimHeight, rect.Width, rect.Height), GraphicsUnit.Pixel);
                //g_main.DrawImage(bitmap, rect, new Rectangle(0, 0, rect.Width, rect.Height + 40), GraphicsUnit.Pixel);

                if (chatVScroll.ShouldBeDraw)//是否绘制滚动条
                {
                    chatVScroll.ReDrawScroll(g_main);
                }
            }

            base.OnPaint(e);
        }