Here are the examples of the csharp api class System.Drawing.Graphics.Restore(System.Drawing.Drawing2D.GraphicsState) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
62 Examples
0
1. Example
Project: SvgNet
Source File: GDIGraphics.cs
Source File: GDIGraphics.cs
public void Restore(GraphicsState gstate) { _g.Restore(gstate); }
0
2. Example
Project: referencesource
Source File: GdiGraphics.cs
Source File: GdiGraphics.cs
public void Restore( GraphicsState gstate ) { _graphics.Restore( gstate ); }
0
3. Example
Project: OpenLiveWriter
Source File: GraphicsHelper.cs
Source File: GraphicsHelper.cs
public void Dispose() { if (!disposed) { disposed = true; graphics.Restore(graphicsState); } }
0
4. Example
Project: ServiceBusExplorer
Source File: AboutForm.cs
Source File: AboutForm.cs
protected void RestoreTransform(Graphics g) { g.Restore(state); }
0
5. Example
Project: Core2D
Source File: WinFormsRenderer.cs
Source File: WinFormsRenderer.cs
public override void PopMatrix(object dc, object state) { var _gfx = dc as Graphics; var _state = state as GraphicsState; _gfx.Restore(_state); }
0
6. Example
Project: DotSpatial
Source File: PointSymbolizer.cs
Source File: PointSymbolizer.cs
public void Draw(Graphics g, double scaleSize) { GraphicsState s = g.Save(); if (Smoothing) { g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = TextRenderingHint.AntiAlias; } else { g.SmoothingMode = SmoothingMode.None; g.TextRenderingHint = TextRenderingHint.SystemDefault; } foreach (ISymbol symbol in Symbols) { symbol.Draw(g, scaleSize); } g.Restore(s); // Changed by jany_ (2015-07-06) remove smoothing because we might not want to smooth whatever is drawn with g afterwards }
0
7. Example
Project: NGraphics
Source File: SystemDrawingPlatform.cs
Source File: SystemDrawingPlatform.cs
public void RestoreState () { if (stateStack.Count > 0) { var s = stateStack.Pop (); graphics.Restore (s); } }
0
8. Example
Project: Cyotek.Windows.Forms.ImageBox
Source File: ScaledAdornmentsDemoForm.cs
Source File: ScaledAdornmentsDemoForm.cs
private void imageBox_Paint(object sender, PaintEventArgs e) { Graphics g; GraphicsState originalState; Size scaledSize; Size originalSize; Size drawSize; bool scaleAdornmentSize; scaleAdornmentSize = scaleAdornmentsCheckBox.Checked; g = e.Graphics; originalState = g.Save(); // Work out the size of the marker graphic according to the current zoom level originalSize = _markerImage.Size; scaledSize = imageBox.GetScaledSize(originalSize); drawSize = scaleAdornmentSize ? scaledSize : originalSize; foreach (Point landmark in _landmarks) { Point location; // Work out the location of the marker graphic according to the current zoom level and scroll offset location = imageBox.GetOffsetPoint(landmark); // adjust the location so that the image is displayed above the location and centered to it location.Y -= drawSize.Height; location.X -= drawSize.Width >> 1; // Draw the marker g.InterpolationMode = InterpolationMode.NearestNeighbor; g.DrawImage(_markerImage, new Rectangle(location, drawSize), new Rectangle(Point.Empty, originalSize), GraphicsUnit.Pixel); } g.Restore(originalState); }
0
9. Example
Project: mbunit-v3
Source File: OverlayManager.cs
Source File: OverlayManager.cs
public void PaintOverlays(OverlayPaintRequest request) { if (request == null) throw new ArgumentNullException("request"); foreach (Overlay overlay in overlays) { GraphicsState originalState = request.Graphics.Save(); try { overlay.Paint(request); } finally { request.Graphics.Restore(originalState); } } }
0
10. Example
Project: referencesource
Source File: ChartWebControl.cs
Source File: ChartWebControl.cs
public void Paint(Graphics graphics, Rectangle position) { // Change chart size to fit the new position int oldWidth = this.chartPicture.Width; int oldHeight = this.chartPicture.Height; // Save graphics state. GraphicsState transState = graphics.Save(); try { this.chartPicture.Width = position.Width; this.chartPicture.Height = position.Height; // Set required transformation graphics.TranslateTransform(position.X, position.Y); // Set printing indicator this.chartPicture.isPrinting = true; // Draw chart this.chartPicture.Paint(graphics, false); // Clear printing indicator this.chartPicture.isPrinting = false; } finally { // Restore graphics state. graphics.Restore(transState); // Restore old chart position this.chartPicture.Width = oldWidth; this.chartPicture.Height = oldHeight; } }
0
11. Example
Project: SharpMap
Source File: SharpDXVectorLayer.cs
Source File: SharpDXVectorLayer.cs
[MethodImpl(MethodImplOptions.Synchronized)] public override void Render(GDI.Graphics g, Map map) { if (map.Center == null) throw (new ApplicationException("Cannot render map. View center not specified")); g.SmoothingMode = SmoothingMode; var envelope = ToSource(map.Envelope); //View to render if (DataSource == null) throw (new ApplicationException("DataSource property not set on layer '" + LayerName + "'")); // Get the transform var transform = new Matrix3x2(g.Transform.Elements); // Save state of the graphics object var gs = g.Save(); // Create and prepare the render target var rt = RenderTargetFactory.Create(_d2d1Factory, g, map); // Set anti-alias mode and transform rt.AntialiasMode = AntialiasMode; rt.Transform = transform; if (Theme != null) RenderInternal(_d2d1Factory, rt, map, envelope, Theme); else RenderInternal(_d2d1Factory, rt, map, envelope); // Clean up the render target RenderTargetFactory.CleanUp(rt, g, map); // Restore the graphics object g.Restore(gs); // Invoke LayerRendered event OnLayerRendered(g); }
0
12. Example
Project: ShareX
Source File: BlurFilter.cs
Source File: BlurFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { int blurRadius = GetFieldValueAsInt(FieldType.BLUR_RADIUS); Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } if (GDIplus.IsBlurPossible(blurRadius)) { GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false); } else { using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) { ImageHelper.ApplyBoxBlur(fastBitmap, blurRadius); fastBitmap.DrawTo(graphics, applyRect); } } graphics.Restore(state); }
0
13. Example
Project: ShareX
Source File: BlurFilter.cs
Source File: BlurFilter.cs
public unsafe override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { int blurRadius = GetFieldValueAsInt(FieldType.BLUR_RADIUS); Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } if (GDIplus.IsBlurPossible(blurRadius)) { GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false); } else { using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) { ImageHelper.ApplyBoxBlur(fastBitmap, blurRadius); fastBitmap.DrawTo(graphics, applyRect); } } graphics.Restore(state); return; }
0
14. Example
Project: ShareX
Source File: BrightnessFilter.cs
Source File: BrightnessFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } float brightness = GetFieldValueAsFloat(FieldType.BRIGHTNESS); using (ImageAttributes ia = ImageHelper.CreateAdjustAttributes(brightness, 1f, 1f)) { graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); } graphics.Restore(state); }
0
15. Example
Project: ShareX
Source File: MagnifierFilter.cs
Source File: MagnifierFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } int magnificationFactor = GetFieldValueAsInt(FieldType.MAGNIFICATION_FACTOR); GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } graphics.SmoothingMode = SmoothingMode.None; graphics.InterpolationMode = InterpolationMode.NearestNeighbor; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.None; int halfWidth = rect.Width / 2; int halfHeight = rect.Height / 2; int newWidth = rect.Width / magnificationFactor; int newHeight = rect.Height / magnificationFactor; Rectangle source = new Rectangle(rect.X + halfWidth - newWidth / 2, rect.Y + halfHeight - newHeight / 2, newWidth, newHeight); graphics.DrawImage(applyBitmap, rect, source, GraphicsUnit.Pixel); graphics.Restore(state); }
0
16. Example
Project: ShareX
Source File: BrightnessFilter.cs
Source File: BrightnessFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } float brightness = GetFieldValueAsFloat(FieldType.BRIGHTNESS); using (ImageAttributes ia = ImageHelper.CreateAdjustAttributes(brightness, 1f, 1f)) { graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); } graphics.Restore(state); }
0
17. Example
Project: ShareX
Source File: MagnifierFilter.cs
Source File: MagnifierFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } int magnificationFactor = GetFieldValueAsInt(FieldType.MAGNIFICATION_FACTOR); GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } graphics.SmoothingMode = SmoothingMode.None; graphics.InterpolationMode = InterpolationMode.NearestNeighbor; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.None; int halfWidth = rect.Width / 2; int halfHeight = rect.Height / 2; int newWidth = rect.Width / magnificationFactor; int newHeight = rect.Height / magnificationFactor; Rectangle source = new Rectangle(rect.X + halfWidth - (newWidth / 2), rect.Y + halfHeight - (newHeight / 2), newWidth, newHeight); graphics.DrawImage(applyBitmap, rect, source, GraphicsUnit.Pixel); graphics.Restore(state); }
0
18. Example
Project: daemaged.ibnet
Source File: CellRenderers.cs
Source File: CellRenderers.cs
protected override void OnDraw(DevAge.Drawing.GraphicsCache graphics, RectangleF area) { System.Drawing.Drawing2D.GraphicsState state = graphics.Graphics.Save(); try { float width2 = area.Width / 2; float height2 = area.Height / 2; //For a better drawing use the clear type rendering graphics.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; //Move the origin to the center of the cell (for a more easy rotation) graphics.Graphics.TranslateTransform(area.X + width2, area.Y + height2); graphics.Graphics.RotateTransform(Angle); StringFormat.Alignment = StringAlignment.Center; StringFormat.LineAlignment = StringAlignment.Center; graphics.Graphics.DrawString(Value, Font, graphics.BrushsCache.GetBrush(ForeColor), 0, 0, StringFormat); } finally { graphics.Graphics.Restore(state); } }
0
19. Example
Project: SAI-Editor
Source File: CustomTabControl.cs
Source File: CustomTabControl.cs
protected new void PaintTransparentBackground(Graphics graphics, Rectangle clipRect) { /n ..... /n //View Source file for more details /n }
0
20. Example
Project: LaserGRBL
Source File: GrblFile.cs
Source File: GrblFile.cs
private static void DrawString(Graphics g, float zoom, decimal curX, decimal curY, string text, bool centerX, bool centerY, bool subtractX, bool subtractY) { GraphicsState state = g.Save(); g.ScaleTransform(1.0f, -1.0f); using (Font f = new Font(FontFamily.GenericMonospace, 8 * 1 / zoom)) { float offsetX = 0; float offsetY = 0; SizeF ms = g.MeasureString(text, f); if (centerX) offsetX = ms.Width / 2; if (centerY) offsetY = ms.Height / 2; if (subtractX) offsetX += ms.Width; if (subtractY) offsetY += ms.Height; using (Brush b = GetBrush(ColorScheme.PreviewText)) { g.DrawString(text, f, b, (float)curX - offsetX, (float)-curY - offsetY); } } g.Restore(state); }
0
21. Example
Project: ShareX
Source File: GrayscaleFilter.cs
Source File: GrayscaleFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } ColorMatrix grayscaleMatrix = new ColorMatrix(new[] { new[] {.3f, .3f, .3f, 0, 0}, new[] {.59f, .59f, .59f, 0, 0}, new[] {.11f, .11f, .11f, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} }); using (ImageAttributes ia = new ImageAttributes()) { ia.SetColorMatrix(grayscaleMatrix); graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); } graphics.Restore(state); }
0
22. Example
Project: ShareX
Source File: HighlightFilter.cs
Source File: HighlightFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) { Color highlightColor = GetFieldValueAsColor(FieldType.FILL_COLOR); for (int y = fastBitmap.Top; y < fastBitmap.Bottom; y++) { for (int x = fastBitmap.Left; x < fastBitmap.Right; x++) { Color color = fastBitmap.GetColorAt(x, y); color = Color.FromArgb(color.A, Math.Min(highlightColor.R, color.R), Math.Min(highlightColor.G, color.G), Math.Min(highlightColor.B, color.B)); fastBitmap.SetColorAt(x, y, color); } } fastBitmap.DrawTo(graphics, applyRect.Location); } graphics.Restore(state); }
0
23. Example
Project: ShareX
Source File: GrayscaleFilter.cs
Source File: GrayscaleFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } ColorMatrix grayscaleMatrix = new ColorMatrix(new float[][] { new float[] {.3f, .3f, .3f, 0, 0}, new float[] {.59f, .59f, .59f, 0, 0}, new float[] {.11f, .11f, .11f, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} }); using (ImageAttributes ia = new ImageAttributes()) { ia.SetColorMatrix(grayscaleMatrix); graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); } graphics.Restore(state); }
0
24. Example
Project: ShareX
Source File: HighlightFilter.cs
Source File: HighlightFilter.cs
public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) { Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert); if (applyRect.Width == 0 || applyRect.Height == 0) { // nothing to do return; } GraphicsState state = graphics.Save(); if (Invert) { graphics.SetClip(applyRect); graphics.ExcludeClip(rect); } using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) { Color highlightColor = GetFieldValueAsColor(FieldType.FILL_COLOR); for (int y = fastBitmap.Top; y < fastBitmap.Bottom; y++) { for (int x = fastBitmap.Left; x < fastBitmap.Right; x++) { Color color = fastBitmap.GetColorAt(x, y); color = Color.FromArgb(color.A, Math.Min(highlightColor.R, color.R), Math.Min(highlightColor.G, color.G), Math.Min(highlightColor.B, color.B)); fastBitmap.SetColorAt(x, y, color); } } fastBitmap.DrawTo(graphics, applyRect.Location); } graphics.Restore(state); }
0
25. Example
Project: EDDiscovery
Source File: TabControlCustom.cs
Source File: TabControlCustom.cs
protected void PaintTransparentBackground(Graphics graphics, Rectangle clipRect) { if ((Parent != null)) { clipRect.Offset(Location); GraphicsState state = graphics.Save(); graphics.TranslateTransform((float)-Location.X, (float)-Location.Y); graphics.SmoothingMode = SmoothingMode.HighSpeed; PaintEventArgs e = new PaintEventArgs(graphics, clipRect); try { InvokePaintBackground(Parent, e); // we force it to paint into our bitmap InvokePaint(Parent, e); // which we do not use. } finally { graphics.Restore(state); clipRect.Offset(-Location.X, -Location.Y); } } }
0
26. Example
Project: P8Coder
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawMiddleClickScrolling(Graphics gr) { // If mouse scrolling mode activated draw the scrolling cursor image bool ableToScrollVertically = this.VerticalScroll.Visible || !ShowScrollBars; bool ableToScrollHorizontally = this.HorizontalScroll.Visible || !ShowScrollBars; // Calculate inverse color Color inverseColor = Color.FromArgb(100, (byte)~this.BackColor.R, (byte)~this.BackColor.G, (byte)~this.BackColor.B); using (SolidBrush inverseColorBrush = new SolidBrush(inverseColor)) { var p = middleClickScrollingOriginPoint; var state = gr.Save(); gr.SmoothingMode = SmoothingMode.HighQuality; gr.TranslateTransform(p.X, p.Y); gr.FillEllipse(inverseColorBrush, -2, -2, 4, 4); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.Restore(state); } }
0
27. Example
Project: P8Coder
Source File: Style.cs
Source File: Style.cs
public override void Draw(Graphics gr, Point position, Range range) { //draw bac/n ..... /n //View Source file for more details /n }
0
28. Example
Project: BaijiGenerator.Net
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawMiddleClickScrolling(Graphics gr) { // If mouse scrolling mode activated draw the scrolling cursor image bool ableToScrollVertically = this.VerticalScroll.Visible || !ShowScrollBars; bool ableToScrollHorizontally = this.HorizontalScroll.Visible || !ShowScrollBars; // Calculate inverse color Color inverseColor = Color.FromArgb(100, (byte)~this.BackColor.R, (byte)~this.BackColor.G, (byte)~this.BackColor.B); using (SolidBrush inverseColorBrush = new SolidBrush(inverseColor)) { var p = middleClickScrollingOriginPoint; var state = gr.Save(); gr.SmoothingMode = SmoothingMode.HighQuality; gr.TranslateTransform(p.X, p.Y); gr.FillEllipse(inverseColorBrush, -2, -2, 4, 4); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.Restore(state); } }
0
29. Example
Project: dash-core
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawMiddleClickScrolling(Graphics gr) { // If mouse scrolling mode activated draw the scrolling cursor image bool ableToScrollVertically = this.VerticalScroll.Visible || !ShowScrollBars; bool ableToScrollHorizontally = this.HorizontalScroll.Visible || !ShowScrollBars; // Calculate inverse color Color inverseColor = Color.FromArgb(100, (byte)~this.BackColor.R, (byte)~this.BackColor.G, (byte)~this.BackColor.B); using (SolidBrush inverseColorBrush = new SolidBrush(inverseColor)) { var p = middleClickScrollingOriginPoint; var state = gr.Save(); gr.SmoothingMode = SmoothingMode.HighQuality; gr.TranslateTransform(p.X, p.Y); gr.FillEllipse(inverseColorBrush, -2, -2, 4, 4); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.Restore(state); } }
0
30. Example
Project: dash-core
Source File: Style.cs
Source File: Style.cs
public override void Draw(Graphics gr, Point position, Range range) { //draw bac/n ..... /n //View Source file for more details /n }
0
31. Example
Project: OpenLiveWriter
Source File: ApplicationForm.cs
Source File: ApplicationForm.cs
void IMainMenuBackgroundPainter.PaintBackground(Graphics g, Rectangle menuItemBounds) { /n ..... /n //View Source file for more details /n }
0
32. Example
Project: OpenLiveWriter
Source File: BorderPaint.cs
Source File: BorderPaint.cs
private void StretchFill(Graphics g, int slice, Rectangle rect, IntPtr pSource, IntPtr pTarget) { GraphicsState gs = g.Save(); try { Debug.Assert(!IsFlagSet(_flags, BorderPaintMode.GDI)); Rectangle sliceRect = _slices[slice]; ImageAttributes ia = _imageAttributes ?? new ImageAttributes(); ia.SetWrapMode(WrapMode.TileFlipXY); // prevents single-pixel darkness at edges PointF[] destPoints = new PointF[] { new PointF(rect.Left, rect.Top), new PointF(rect.Right, rect.Top), new PointF(rect.Left, rect.Bottom), }; if (IsFlagSet(_flags, BorderPaintMode.Cached)) g.DrawImage(_sliceCache[slice], destPoints, new Rectangle(Point.Empty, sliceRect.Size), GraphicsUnit.Pixel, ia); else g.DrawImage(_bitmap, destPoints, sliceRect, GraphicsUnit.Pixel, ia); if (ia != _imageAttributes) ia.Dispose(); } finally { g.Restore(gs); } }
0
33. Example
Project: DatabaseBenchmark
Source File: LoadingFrame.cs
Source File: LoadingFrame.cs
private void Loading_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; Image img = DatabaseBenchmark.Properties.Resources.loading_throbber_icon; SizeF textSize = graphics.MeasureString(Text, Font); GraphicsState state = graphics.Save(); graphics.SmoothingMode = SmoothingMode.HighQuality; // Draw and rotate image. graphics.TranslateTransform(Width / 2 - img.Width / 2, Height / 2 - img.Height / 2); graphics.TranslateTransform(img.Width / 2, img.Height / 2); graphics.RotateTransform(Angle); graphics.TranslateTransform(-img.Width / 2, -img.Height / 2); graphics.DrawImage(img, Point.Empty); graphics.Restore(state); Font font = new Font("Times New Roman", 12.0f, FontStyle.Bold); graphics.DrawString(Text, font, Brushes.Black, new PointF(Width / 2 - textSize.Width / 2, Height / 2 + img.Height / 2 + 10)); }
0
34. Example
Project: ynoteclassic
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawMiddleClickScrolling(Graphics gr) { // If mouse scrolling mode activated draw the scrolling cursor image bool ableToScrollVertically = this.VerticalScroll.Visible || !ShowScrollBars; bool ableToScrollHorizontally = this.HorizontalScroll.Visible || !ShowScrollBars; // Calculate inverse color Color inverseColor = Color.FromArgb(100, (byte)~this.BackColor.R, (byte)~this.BackColor.G, (byte)~this.BackColor.B); using (SolidBrush inverseColorBrush = new SolidBrush(inverseColor)) { var p = middleClickScrollingOriginPoint; var state = gr.Save(); gr.SmoothingMode = SmoothingMode.HighQuality; gr.TranslateTransform(p.X, p.Y); gr.FillEllipse(inverseColorBrush, -2, -2, 4, 4); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollVertically) DrawTriangle(gr, inverseColorBrush); gr.RotateTransform(90); if (ableToScrollHorizontally) DrawTriangle(gr, inverseColorBrush); gr.Restore(state); } }
0
35. Example
Project: ynoteclassic
Source File: Style.cs
Source File: Style.cs
public override void Draw(Graphics gr, Point position, Range range) { //draw bac/n ..... /n //View Source file for more details /n }
0
36. Example
Project: DropboxBusinessAdminTool
Source File: ButtonEx.cs
Source File: ButtonEx.cs
protected void PaintTransparentBackground(Graphics g, Rectangle clipRect) { // check if we have a parent if (this.Parent != null) { // convert the clipRects coordinates from ours to our parents clipRect.Offset(this.Location); PaintEventArgs e = new PaintEventArgs(g, clipRect); GraphicsState state = g.Save(); try { // move the graphics object so that we are drawing in // the correct place g.TranslateTransform((float)-this.Location.X, (float)-this.Location.Y); // draw the parents background and foreground this.InvokePaintBackground(this.Parent, e); this.InvokePaint(this.Parent, e); return; } finally { // reset everything back to where they were before g.Restore(state); clipRect.Offset(-this.Location.X, -this.Location.Y); } } // we don't have a parent, so fill the rect with // the default control color g.FillRectangle(SystemBrushes.Control, clipRect); }
0
37. Example
Project: RTVS
Source File: PackageSourcesOptionsControl.cs
Source File: PackageSourcesOptionsControl.cs
private void PackageSourcesListBox_DrawItem(object sender, DrawItemEventArgs e) { var cu/n ..... /n //View Source file for more details /n }
0
38. Example
Project: oxyplot
Source File: GraphicsRenderContext.cs
Source File: GraphicsRenderContext.cs
public override void DrawText( ScreenPoint p, string text, OxyCo/n ..... /n //View Source file for more details /n }
0
39. Example
Project: NuGet
Source File: PackageSourcesOptionsControl.cs
Source File: PackageSourcesOptionsControl.cs
private void PackageSourcesListBox_DrawItem(object sender, DrawItemEventArgs e) { /n ..... /n //View Source file for more details /n }
0
40. Example
Project: PdfReport.Core
Source File: GraphicsRenderContext.cs
Source File: GraphicsRenderContext.cs
public override void DrawText( ScreenPoint p, string text, OxyCo/n ..... /n //View Source file for more details /n }
0
41. Example
Project: Core2D
Source File: WinFormsRenderer.cs
Source File: WinFormsRenderer.cs
private static PointF DrawLineArrowInternal(Graphics gfx, Pen pen, Brush brush, float x, float y, fl/n ..... /n //View Source file for more details /n }
0
42. Example
Project: Krypton
Source File: MyUserControl.cs
Source File: MyUserControl.cs
protected override void OnPaint(PaintEventArgs e) { if (_palette != null) /n ..... /n //View Source file for more details /n }
0
43. Example
Project: P8Coder
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawRecordingHint(Graphics graphics) { const int w = 75; const int h = 13; var rect = new Rectangle(ClientRectangle.Right - w, ClientRectangle.Bottom - h, w, h); var iconRect = new Rectangle(-h/2 + 3, -h/2 + 3, h - 7, h - 7); var state = graphics.Save(); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TranslateTransform(rect.Left + h/2, rect.Top + h/2); var ts = new TimeSpan(DateTime.Now.Ticks); graphics.RotateTransform(180 * (DateTime.Now.Millisecond/1000f)); using (var pen = new Pen(Color.Red, 2)) { graphics.DrawArc(pen, iconRect, 0, 90); graphics.DrawArc(pen, iconRect, 180, 90); } graphics.DrawEllipse(Pens.Red, iconRect); graphics.Restore(state); using (var font = new Font(FontFamily.GenericSansSerif, 8f)) graphics.DrawString("Recording...", font, Brushes.Red, new PointF(rect.Left + h, rect.Top)); System.Threading.Timer tm = null; tm = new System.Threading.Timer( (o) => { Invalidate(rect); tm.Dispose(); }, null, 200, System.Threading.Timeout.Infinite); }
0
44. Example
Project: BaijiGenerator.Net
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawRecordingHint(Graphics graphics) { const int w = 75; const int h = 13; var rect = new Rectangle(ClientRectangle.Right - w, ClientRectangle.Bottom - h, w, h); var iconRect = new Rectangle(-h/2 + 3, -h/2 + 3, h - 7, h - 7); var state = graphics.Save(); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TranslateTransform(rect.Left + h/2, rect.Top + h/2); var ts = new TimeSpan(DateTime.Now.Ticks); graphics.RotateTransform(180 * (DateTime.Now.Millisecond/1000f)); using (var pen = new Pen(Color.Red, 2)) { graphics.DrawArc(pen, iconRect, 0, 90); graphics.DrawArc(pen, iconRect, 180, 90); } graphics.DrawEllipse(Pens.Red, iconRect); graphics.Restore(state); using (var font = new Font(FontFamily.GenericSansSerif, 8f)) graphics.DrawString("Recording...", font, Brushes.Red, new PointF(rect.Left + h, rect.Top)); System.Threading.Timer tm = null; tm = new System.Threading.Timer( (o) => { Invalidate(rect); tm.Dispose(); }, null, 200, System.Threading.Timeout.Infinite); }
0
45. Example
Project: BaijiGenerator.Net
Source File: Style.cs
Source File: Style.cs
public override void Draw(Graphics gr, Point position, Range range) { //draw bac/n ..... /n //View Source file for more details /n }
0
46. Example
Project: dash-core
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawRecordingHint(Graphics graphics) { const int w = 75; const int h = 13; var rect = new Rectangle(ClientRectangle.Right - w, ClientRectangle.Bottom - h, w, h); var iconRect = new Rectangle(-h/2 + 3, -h/2 + 3, h - 7, h - 7); var state = graphics.Save(); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TranslateTransform(rect.Left + h/2, rect.Top + h/2); var ts = new TimeSpan(DateTime.Now.Ticks); graphics.RotateTransform(180 * (DateTime.Now.Millisecond/1000f)); using (var pen = new Pen(Color.Red, 2)) { graphics.DrawArc(pen, iconRect, 0, 90); graphics.DrawArc(pen, iconRect, 180, 90); } graphics.DrawEllipse(Pens.Red, iconRect); graphics.Restore(state); using (var font = new Font(FontFamily.GenericSansSerif, 8f)) graphics.DrawString("Recording...", font, Brushes.Red, new PointF(rect.Left + h, rect.Top)); System.Threading.Timer tm = null; tm = new System.Threading.Timer( (o) => { Invalidate(rect); tm.Dispose(); }, null, 200, System.Threading.Timeout.Infinite); }
0
47. Example
Project: scharfrichter
Source File: Pot.cs
Source File: Pot.cs
protected override void OnPaint(PaintEventArgs e) { int diameter = Math.Min(this.Width-4,this.Height-4); Pen potPen = new Pen(ForeColor,3.0f); potPen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; System.Drawing.Drawing2D.GraphicsState state = e.Graphics.Save(); //e.Graphics.TranslateTransform(diameter / 2f, diameter / 2f); e.Graphics.TranslateTransform(this.Width / 2, this.Height / 2); e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; e.Graphics.DrawArc(potPen, new Rectangle(diameter / -2, diameter / -2, diameter, diameter), 135, 270); double percent = (value - minimum) / (maximum - minimum); double degrees = 135 + (percent * 270); double x = (diameter / 2.0) * Math.Cos(Math.PI * degrees / 180); double y = (diameter / 2.0) * Math.Sin(Math.PI * degrees / 180); e.Graphics.DrawLine(potPen, 0, 0, (float) x, (float) y); e.Graphics.Restore(state); base.OnPaint(e); }
0
48. Example
Project: ynoteclassic
Source File: FastColoredTextBox.cs
Source File: FastColoredTextBox.cs
private void DrawRecordingHint(Graphics graphics) { const int w = 75; const int h = 13; var rect = new Rectangle(ClientRectangle.Right - w, ClientRectangle.Bottom - h, w, h); var iconRect = new Rectangle(-h / 2 + 3, -h / 2 + 3, h - 7, h - 7); var state = graphics.Save(); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TranslateTransform(rect.Left + h / 2, rect.Top + h / 2); var ts = new TimeSpan(DateTime.Now.Ticks); graphics.RotateTransform(180 * (DateTime.Now.Millisecond / 1000f)); using (var pen = new Pen(Color.Red, 2)) { graphics.DrawArc(pen, iconRect, 0, 90); graphics.DrawArc(pen, iconRect, 180, 90); } graphics.DrawEllipse(Pens.Red, iconRect); graphics.Restore(state); using (var font = new Font(FontFamily.GenericSansSerif, 8f)) graphics.DrawString("Recording...", font, Brushes.Red, new PointF(rect.Left + h, rect.Top)); System.Threading.Timer tm = null; tm = new System.Threading.Timer( (o) => { Invalidate(rect); tm.Dispose(); }, null, 200, System.Threading.Timeout.Infinite); }
0
49. Example
Project: DCS-SimpleRadioStandalone
Source File: Pot.cs
Source File: Pot.cs
protected override void OnPaint(PaintEventArgs e) { int diameter = Math.Min(this.Width-4,this.Height-4); Pen potPen = new Pen(ForeColor,3.0f); potPen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; System.Drawing.Drawing2D.GraphicsState state = e.Graphics.Save(); //e.Graphics.TranslateTransform(diameter / 2f, diameter / 2f); e.Graphics.TranslateTransform(this.Width / 2, this.Height / 2); e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; e.Graphics.DrawArc(potPen, new Rectangle(diameter / -2, diameter / -2, diameter, diameter), 135, 270); double percent = (value - minimum) / (maximum - minimum); double degrees = 135 + (percent * 270); double x = (diameter / 2.0) * Math.Cos(Math.PI * degrees / 180); double y = (diameter / 2.0) * Math.Sin(Math.PI * degrees / 180); e.Graphics.DrawLine(potPen, 0, 0, (float) x, (float) y); e.Graphics.Restore(state); base.OnPaint(e); }
0
50. Example
Project: winforms
Source File: PropertyGrid.cs
Source File: PropertyGrid.cs
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle); GraphicsState originalState = e.Graphics.Save(); if (this.mainEditor != null) { Rectangle editorRect = new Rectangle(this.ClientRectangle.Location, this.mainEditor.Size); editorRect.Intersect(this.ClientRectangle); RectangleF clipRect = editorRect; clipRect.Intersect(e.Graphics.ClipBounds); e.Graphics.SetClip(clipRect); e.Graphics.TranslateTransform(this.ClientRectangle.X, this.ClientRectangle.Y + this.AutoScrollPosition.Y); this.mainEditor.OnPaint(e); } e.Graphics.Restore(originalState); }