private void PictureBox_Paint(object sender, PaintEventArgs e) { if (control.Image == null) return; e.Graphics.SetClip(control.ToPictureBoxCoordinate(new RectangleF(0, 0, control.Image.Width, control.Image.Height))); e.Graphics.DrawRectangle(Pen, control.ToPictureBoxCoordinate(rect)); e.Graphics.ResetClip(); }
public void EndDraw(PaintEventArgs e) { if (bitmapGraphics != null) { bitmapGraphics.Dispose(); bitmapGraphics = null; e.Graphics.DrawImage(OffscreenBitmap, new RectangleF(e.ClipRectangle.Size), e.ClipRectangle); } }
protected override void OnPaint(PaintEventArgs e) { var graphics = e.Graphics; graphics.PixelOffsetMode = pixelOffsetMode; graphics.Clear(Brushes.White); if (test != null) test.Test(e.Graphics); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (Image != null) { if (ScaleImage) e.Graphics.DrawImage(Image, 0, 0, ClientSize.Width, ClientSize.Height); else e.Graphics.DrawImage(Image, new PointF((ClientSize - Image.Size) / 2)); } }
protected sealed override void OnPaint(PaintEventArgs e) { if (EnableDoubleBuffering) { var screen = ParentWindow.Screen; var scale = screen.RealScale / screen.Scale; renderSize = Size.Round(e.ClipRectangle.Size * scale); if (bitmap == null || bitmap.Size.Width < renderSize.Width || bitmap.Size.Height < renderSize.Height) { if (bitmap != null) bitmap.Dispose(); bitmap = new Bitmap(renderSize, PixelFormat.Format32bppRgba); } var bitmapGraphics = new Graphics(bitmap); bitmapGraphics.Clear(Brushes.Cached(BackgroundColor)); bitmapGraphics.ScaleTransform(scale); bitmapGraphics.TranslateTransform(-e.ClipRectangle.Location); bitmapGraphics.SetClip(e.ClipRectangle * scale); // should be affected by transform var childArgs = new PaintEventArgs(bitmapGraphics, e.ClipRectangle); base.OnPaint(childArgs); OnBufferedPaint(childArgs); bitmapGraphics.Dispose(); bitmapGraphics = null; e.Graphics.DrawImage(bitmap, new RectangleF(renderSize), e.ClipRectangle); if (Platform.IsWpf) { // wpf runs out of resources fast here, so we garbage collect GC.Collect(); } } else { base.OnPaint(e); OnBufferedPaint(e); } }
public Graphics BeginDraw(PaintEventArgs e) { if (UseOffScreenBitmap) { if (OffscreenBitmap == null || OffscreenBitmap.Size.Width < e.ClipRectangle.Width || OffscreenBitmap.Size.Height < e.ClipRectangle.Height) { if (OffscreenBitmap != null) OffscreenBitmap.Dispose(); OffscreenBitmap = new Bitmap(Size.Round(e.ClipRectangle.Size), PixelFormat.Format32bppRgba); } bitmapGraphics = new Graphics(OffscreenBitmap); bitmapGraphics.TranslateTransform(-e.ClipRectangle.Location); bitmapGraphics.SetClip(e.ClipRectangle); bitmapGraphics.Clear(Brushes.Cached(drawable.BackgroundColor)); return bitmapGraphics; } return e.Graphics; }
public override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (Image != null) e.Graphics.DrawImage(Image, PointF.Empty); }
/// <summary> /// Raises the <see cref="Paint"/> event /// </summary> /// <param name="e">Paint event arguments</param> protected virtual void OnPaint(PaintEventArgs e) { if (Paint != null) Paint(this, e); }
/// <summary> /// Raises the paint event. /// </summary> public void OnPaint(Drawable widget, PaintEventArgs e) { widget.Platform.Invoke(() => widget.OnPaint(e)); }
protected virtual void OnBufferedPaint(PaintEventArgs e) { }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (FrameCount > 0) { System.Diagnostics.Debug.WriteLine("{0}: {1} seconds per paint (spp)", this, _stopwatch.Elapsed.TotalSeconds / FrameCount); } _stopwatch.Start(); MapRenderer<Drawable> renderer = new MapRenderer<Drawable>(new EtoRenderer2D(e.Graphics)); View2D view = renderer.Create(ClientSize.Width, ClientSize.Height, _map, Zoom, Center, XInverted, YInverted); _map.ViewChanged(Zoom, Center, null, view); renderer.Render(this, _map, view, Zoom); _stopwatch.Stop(); FrameCount++; }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (_content != null) { var bounds = SizeBounds; bounds.Inflate(GripPadding); var mouseLocation = PointFromScreen(Mouse.Position); if (IsSizing) e.Graphics.DrawRectangle(GripColor, bounds); foreach (var grip in _grips) { if (!IsSizing && !grip.GetShouldDraw(mouseLocation)) continue; if (grip.Draw != null) grip.Draw(e.Graphics); else e.Graphics.FillEllipse(GripColor, grip.Location()); } } }
public virtual void OnPaint(PaintEventArgs e) { if (Paint != null) Paint(this, e); }
public override void Invalidate(Rectangle rect) { var graphics = new Graphics(new Drawing.TestGraphicsHandler(Widget)); var e = new PaintEventArgs(graphics, rect); Callback.OnPaint(Widget, e); }
private void PictureBox_Paint(object sender, PaintEventArgs e) { if (control.Image == null) return; e.Graphics.SetClip(control.ToPictureBoxCoordinate(new RectangleF(0, 0, control.Image.Width, control.Image.Height))); drawPaths(e.Graphics, Paths, p => control.ToPictureBoxCoordinate(p), control.ZoomFactor); e.Graphics.ResetClip(); }
protected override void OnPaint(PaintEventArgs e) { if (Image != null) { e.Graphics.DrawImage(Image, imageBounds); } base.OnPaint(e); }