public override void DrawScreenOn(Gdi mem, Rectangle rect) { var fromDC = _fromGraphics.GetHdc(); var toDC = _ToGraphics.GetHdc(); var toWidth = (int)(ViewTransitionManager.TransitionCanvas.Width * _transitionPct); if (SlideDirection == TransitionType.SlideLeft) toWidth = ViewTransitionManager.TransitionCanvas.Width - toWidth; int fromWidth = ViewTransitionManager.TransitionCanvas.Width - toWidth; if (SlideDirection == TransitionType.SlideLeft) { mem.BitBlt(0, 0, toWidth, _FromBitmap.Height, fromDC, fromWidth, 0, TernaryRasterOperations.SRCCOPY); mem.BitBlt(toWidth, 0, fromWidth, _ToBitmap.Height, toDC, 0, 0, TernaryRasterOperations.SRCCOPY); } else { mem.BitBlt(0, 0, toWidth, _FromBitmap.Height, toDC, fromWidth, 0, TernaryRasterOperations.SRCCOPY); mem.BitBlt(toWidth, 0, fromWidth, _ToBitmap.Height, fromDC, 0, 0, TernaryRasterOperations.SRCCOPY); } _fromGraphics.ReleaseHdc(fromDC); _ToGraphics.ReleaseHdc(toDC); }
public void DrawRender(Gdi g) { Rectangle rect = new Rectangle(0, 0, Width, Height); IntPtr hdcMem = OffScreenGraphics.GetHdc(); using (Gdi gMem = Gdi.FromHdc(hdcMem, Rectangle.Empty)) { DrawScreenOn(gMem, rect, _currentScrollPosition); g.BitBlt(Location.X, Location.Y, rect.Width, rect.Height, gMem, 0, 0, TernaryRasterOperations.SRCCOPY); } OffScreenGraphics.ReleaseHdc(hdcMem); }
protected override void OnRender(Gdi graphics, Rectangle clipRect) { IntPtr ptrSrc = OffscreenBuffer.OffScreenGraphics.GetHdc(); using (Gdi gr = Gdi.FromHdc(ptrSrc, Rectangle.Empty)) { DrawBackground(gr, clipRect); // fill background with double gradient var y = (int)(_backgroundRectangle.Height * _gradientCenter); gr.GradientFill(new Rectangle(_backgroundRectangle.Left, _backgroundRectangle.Top, _backgroundRectangle.Width, y), _gradientColor1, _gradientColor2, FillDirection.TopToBottom); gr.GradientFill(new Rectangle(_backgroundRectangle.Left, _backgroundRectangle.Top + y, _backgroundRectangle.Width, _backgroundRectangle.Height - y), _gradientColor2, _gradientColor3, FillDirection.TopToBottom); // Pass the graphics to the canvas to render if (Canvas != null) { Canvas.Render(gr, clipRect); } //Draw Text SetFont(gr); gr.DrawText(_message, new Win32.RECT(_textRectangle.X, _textRectangle.Y, _textRectangle.Width, _textRectangle.Height), Win32.DT.LEFT | Win32.DT.TOP | Win32.DT.WORDBREAK); } graphics.BitBlt(clipRect.Left, clipRect.Top, Width, Height, ptrSrc, clipRect.Left, clipRect.Top, TernaryRasterOperations.SRCCOPY); OffscreenBuffer.OffScreenGraphics.ReleaseHdc(ptrSrc); }