首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

关于双缓冲的一个有关问题

2013-04-21 
关于双缓冲的一个问题Rectangle rect e.ClipRectangleBufferedGraphicsContext currentContext Buffe

关于双缓冲的一个问题


Rectangle rect = e.ClipRectangle;

            BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
            BufferedGraphics myBuffer = currentContext.Allocate(e.Graphics, e.ClipRectangle);
            Graphics g = myBuffer.Graphics;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed;
            g.Clear(this.BackColor);
            
            foreach (IShape drawobject in doc.drawObjectList)
            {
                if (rect.IntersectsWith(drawobject.Rect))
                {
                    drawobject.Draw(g);
                    if (drawobject.TrackerState == config.Module.Core.TrackerState.Selected
                        && this.CurrentOperator == Enum.Operator.Transfrom)//仅当编辑节点操作时显示图元热点
                    {
                        drawobject.DrawTracker(g);
                    }
                }
            }

            myBuffer.Render(e.Graphics);
            g.Dispose();
            myBuffer.Dispose();//释放资源

谁能告诉我在哪个foreach中的doc是什么变量,怎么来的 ,,,求解释 双缓冲 c#
[解决办法]
双缓冲,加下面的代码
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
[解决办法]
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
方式可以,用过后基本不闪烁了,原来很闪
[解决办法]
引用:
引用:要是猜得不错的话,这些代码可能是需要画一个图形之类的,doc应该在上文有定义,楼主这只是其中一部分代码
这个是用来解决图形界面变化时出现闪烁的问题,,我在网上找来的好像只有这么一段

楼主可以联系原文作者哇

热点排行