/// <summary> /// See C++ documentation /// </summary> public void DrawTheRootAt(IVwRootBox prootb, IntPtr hdc, Rect rcpDraw, uint bkclr, bool fDrawSel, IVwGraphics pvg, Rect rcSrc, Rect rcDst, int ysTop, int dysHeight) { IVwGraphicsWin32 qvg32 = VwGraphicsWin32Class.Create(); using (Graphics screen = Graphics.FromHdc(hdc)) { Rectangle rcp = rcpDraw; Rectangle rcFill = new Rect(0, 0, rcp.Width, rcp.Height); using (var memoryBuffer = new MemoryBuffer(rcp.Width, rcp.Height)) { memoryBuffer.Graphics.FillRectangle(new SolidBrush(ColorUtil.ConvertBGRtoColor(bkclr)), rcFill); qvg32.Initialize(memoryBuffer.Graphics.GetHdc()); qvg32.XUnitsPerInch = rcDst.right - rcDst.left; qvg32.YUnitsPerInch = rcDst.bottom - rcDst.top; try { prootb.DrawRoot2(qvg32, rcSrc, rcDst, fDrawSel, ysTop, dysHeight); } catch (Exception) { qvg32.ReleaseDC(); throw; } screen.DrawImageUnscaled(memoryBuffer.Bitmap, rcp); qvg32.ReleaseDC(); } } }