public override void Dispose() { if (rgn != null) { rgn.Dispose(); rgn = null; } }
protected override void OnViewerDoubleBufferPaint(System.Windows.Forms.PaintEventArgs e) { base.OnViewerDoubleBufferPaint(e); System.Drawing.Rectangle visibleRectangle = System.Drawing.Rectangle.Intersect(e.ClipRectangle, _bitmapViewer.GetViewportBounds()); System.Drawing.Region prevClip = e.Graphics.Clip.Clone(); System.Drawing.Region newClip = new System.Drawing.Region(visibleRectangle); try { e.Graphics.Clip = newClip; _vObjectHost.DrawContent(e.Graphics, visibleRectangle, (ICoordinateMapper)_bitmapViewer); } finally { e.Graphics.Clip = prevClip; newClip.Dispose(); } _vObjectHost.CurrentDesigner.Draw(e.Graphics); }