protected override void OnPaint(PaintEventArgs e) { Debug.WriteLine("OnPaint"); //draw something on the back surface var p1 = new PointD(10, 10); var p2 = new PointD(100, 10); var p3 = new PointD(100, 100); var p4 = new PointD(10, 100); BackContext.SetSourceColor(new Cairo.Color(1,0,0)); BackContext.MoveTo(p1); BackContext.LineTo(p2); BackContext.LineTo(p3); BackContext.LineTo(p4); BackContext.LineTo(p1); BackContext.ClosePath(); BackContext.Stroke(); BackContext.SetSourceColor(new Cairo.Color(0, 1, 0)); BackContext.MoveTo(new PointD(p3.X + 10, p3.Y + 10)); Cairo.Path path = DWriteCairo.RenderLayoutToCairoPath(BackContext, textLayout); BackContext.AppendPath(path); path.Dispose(); BackContext.Fill(); //copy back surface to font surface SwapBuffer(); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); int x = (SplitterRectangle.Width - Properties.Resources.longGripOff.Width) / 2; e.Graphics.DrawImageUnscaled(Properties.Resources.longGripOff, x, SplitterRectangle.Top); }
// Draw the new button. protected override void OnPaint(PaintEventArgs e) { GraphicsPath grPath = new GraphicsPath(); grPath.AddEllipse(10, 10, 60, 60); this.Region = new System.Drawing.Region(grPath); base.OnPaint(e); }
private void BrowserPaint(object sender, PaintEventArgs e) { browser.Paint -= BrowserPaint; //Invalidate browser as short term fix for #522 browser.Invalidate(); }
private void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e) { //OpenGL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); //Point mousePosition = this.glCanvas1.PointToClient(Control.MousePosition); this.scene.Render(); }
/// <summary> /// 绘制界面 /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { if (Columns.Count != 0) { this.Columns["ID"].Visible = false; this.Columns["State"].Visible = false; this.Columns["Ver"].Visible = false; this.Columns["Group"].Visible = false; this.Columns["NoAnswer"].Visible = false; this.Columns["CmdVersion"].Visible = false; this.Columns["CmdPolling"].Visible = false; this.Columns["CmdPollingRight"].Visible = false; this.Columns["CmdReset"].Visible = false; this.Columns["IsPointSelect"].Visible = false; this.Columns["CmdTwo"].Visible = false; this.Columns["IsTwo"].Visible = false; this.Columns["IpAddress"].Visible = false; this.Columns["Port"].Visible = false; this.Columns["SCmd"].Visible = false; this.Columns["SaveCount"].Visible = false; this.Columns["TimeCheckOut"].Visible = false; this.Columns["StationModel"].Visible = false; this.Columns["Address"].HeaderText = "地址"; this.Columns["Address"].Width = 60; this.Columns["Address"].DisplayIndex = 0; this.Columns["CState"].HeaderText = "状态描述"; this.Columns["CState"].Width = 100; this.Columns["CState"].DisplayIndex = 1; } base.OnPaint(e); }
private void PictureBoxPaint(object sender, PaintEventArgs e) { var bitmaps = _goldBoxFile.Bitmaps; const int padding = 6; var x = 0; var y = 0; var bitmapCount = bitmaps.Count; var rowImageHeight = 0; for (var i = 0; i < bitmapCount; i++) { var currentImage = bitmaps[i]; if (x + (currentImage.Width * Zoom) > ContainerWidth) { x = 0; y += rowImageHeight + (int)(padding * Zoom); rowImageHeight = (int)(currentImage.Height * Zoom); } else { rowImageHeight = Math.Max(rowImageHeight, (int)(currentImage.Height * Zoom)); } e.Graphics.DrawImage(currentImage, x, y, currentImage.Width * Zoom, currentImage.Height * Zoom); x += (int)((currentImage.Width + padding) * Zoom); } _pictureBox.Width = ContainerWidth; _pictureBox.Height = y + (int)((rowImageHeight * Zoom)); }
private void PictureBoxPaint(object sender, PaintEventArgs e) { var bitmaps = _file.Bitmaps; const int padding = 6; var x = 0; var y = 25; var bitmapCount = bitmaps.Count; var rowImageHeight = 0; for (var i = 0; i < bitmapCount; i++) { var currentImage = bitmaps[i]; // make sure walls are displayed a row at a time - ie start a new row at 10, 20, 29, 38 + 47 if we have a wallTLB if (x + (currentImage.Width * Zoom) > ContainerWidth || (_wallTlb && (i % 47 == 10 || i % 47 == 20 || i % 47 == 29 || i % 47 == 38 || i % 47 == 0))) { x = 0; y += rowImageHeight + (int)(padding * Zoom); rowImageHeight = (int)(currentImage.Height * Zoom); } else { rowImageHeight = Math.Max(rowImageHeight, (int)(currentImage.Height * Zoom)); } e.Graphics.DrawImage(currentImage, x, y, currentImage.Width * Zoom, currentImage.Height * Zoom); x += (int)((currentImage.Width + padding) * Zoom); } _pictureBox.Width = ContainerWidth; _pictureBox.Height = y + (int)((rowImageHeight * Zoom)); }
protected override void OnPaint(PaintEventArgs e) { //this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) // | System.Windows.Forms.AnchorStyles.Right))); //this.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular); base.OnPaint(e); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (grContext != null) { var desc = new GRBackendRenderTargetDesc { Width = Width, Height = Height, Config = GRPixelConfig.Bgra8888, Origin = GRSurfaceOrigin.TopLeft, SampleCount = 1, StencilBits = 0, RenderTargetHandle = IntPtr.Zero, }; using (var surface = SKSurface.Create(grContext, desc)) { var skcanvas = surface.Canvas; sample.Method(skcanvas, Width, Height); skcanvas.Flush(); } SwapBuffers(); } }
protected override void OnPaint(PaintEventArgs pe) { pe.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; pe.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; pe.Graphics.SmoothingMode = SmoothingMode.None; base.OnPaint(pe); }
/// <summary> /// OnPaint rendert die DBGraphics-Graphik /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { if (DBpanelgr.CanDoubleBuffer() && !blockRedraw) { DBpanelgr.Render(e.Graphics); } }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Tick(); Render(); }
protected override void OnPaintBackground(PaintEventArgs e) { if (!this.IsTransparent) { base.OnPaintBackground(e); } }
/// <summary> /// Overrides the Painting logic because painting will be handled /// using timers and DirectX. If the control is in design mode, then /// clear it because DirectX isn't available yet. /// </summary> /// <param name="e">Graphics context objects</param> protected override void OnPaint(PaintEventArgs e) { if (DesignMode) { e.Graphics.Clear(BackColor); } }
protected override void OnPaint(PaintEventArgs pevent) { GraphicsPath grPath = new GraphicsPath(); grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height); this.Region = new System.Drawing.Region(grPath); base.OnPaint(pevent); }
/// <summary> /// Receives a call when the control that the designer is managing has painted /// its surface so the designer can paint any additional adornments on top of /// the control. /// </summary> /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param> protected override void OnPaintAdornments(PaintEventArgs e) { if (_checkBox != null && !_checkBox.AutoSize) { NuGenDesignerRenderer.DrawAdornments(e.Graphics, _checkBox.ClientRectangle); } }
void xpanel_Paint(object sender, PaintEventArgs e) { if (this.mRefreshMode != RegionRefreshMode.Always) { this.Render(); } }
protected override void OnPaint(PaintEventArgs e) { this.winBridge.InvalidateRootArea( e.ClipRectangle.ToRect()); this.winBridge.PaintToOutputWindow(); base.OnPaint(e); }
protected override void OnPaintBackground(PaintEventArgs e) { var page = Program.MainWindow.navigationControl.CurrentNavigatable as Control; if (page?.BackgroundImage != null) this.RenderControlBgImage(page, e); else e.Graphics.Clear(Config.BgColor); FrameBorderRenderer.Instance.RenderToGraphics(e.Graphics, DisplayRectangle, FrameBorderRenderer.StyleType.Shraka); }
private void pnlDrawArea_Paint(object sender, PaintEventArgs e) { foreach(var obj in displayableObjects) { obj.Draw(e.Graphics); } }
public void DrawAll(PaintEventArgs e) { foreach (IDrawable drawit in drawable) { drawit.Draw(e); } }
protected override void OnPaint(PaintEventArgs pe) { pe.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; pe.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; pe.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; base.OnPaint(pe); }
public void NormalOperation() { // need to create a dummy form because PaintEventArgs wants a Graphics object using (DummyForm dummy = new DummyForm()) { dummy.Create(); using (TestControl1 tc1 = new TestControl1()) { Message m1 = Message.Create(IntPtr.Zero, 10, new IntPtr(101), new IntPtr(1001)); tc1.CallWndProc(ref m1); Message m2 = Message.Create(IntPtr.Zero, 20, new IntPtr(201), new IntPtr(2001)); tc1.CallWndProc(ref m2); using (var g = dummy.CreateGraphics()) { using (var pe1 = new PaintEventArgs(g, new System.Drawing.Rectangle(0, 1, 2, 3))) { tc1.CallOnPaint(pe1); Message m3 = Message.Create(IntPtr.Zero, 30, new IntPtr(301), new IntPtr(3001)); tc1.CallWndProc(ref m3); object[] expected = { m1, m1, m2, m2, pe1, pe1, m3, m3 }; VerifyArray(expected, tc1); } } } } }
protected override void OnPaint(PaintEventArgs pe) { pe.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; pe.Graphics.CompositingMode = CompositingMode.SourceCopy; pe.Graphics.PixelOffsetMode = PixelOffsetMode.Half; base.OnPaint(pe); }
protected override void OnPaint(PaintEventArgs e) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; base.OnPaint(e); }
/// <summary> /// Receives a call when the control that the designer is managing has painted its surface so the designer can paint any additional adornments on top of the control. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> the designer can use to draw on the control.</param> protected override void OnPaintAdornments(PaintEventArgs e) { if (_switchButton != null) { NuGenDesignerRenderer.DrawAdornments(e.Graphics, _switchButton.ClientRectangle); } }
private void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e) { GL.ClearColor(0x87 / 255.0f, 0xce / 255.0f, 0xeb / 255.0f, 0xff / 255.0f); GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); var arg = new RenderEventArgs(RenderModes.Render, null); pyramidElement.Render(arg); }
private void pictureBoxExample_Paint(object sender, PaintEventArgs e) { if (!_drawTimer.Enabled) { return; } SparkleTree.DrawTrees(e.Graphics, _effectValues, _tickCount); }
protected override void OnPaint(PaintEventArgs pe) { if (this.Image != null) { pe.Graphics.TranslateTransform(this.Width - this.Image.Width, this.Height - this.Image.Height); } base.OnPaint(pe); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { int currentXPos = 0; int currentYPos = 0; bool adjustScrollBars = false; Graphics g = e.Graphics; Rectangle clipRectangle = e.ClipRectangle; bool isFullRepaint = clipRectangle.X == 0 && clipRectangle.Y == 0 && clipRectangle.Width == this.Width && clipRectangle.Height == this.Height; g.TextRenderingHint = this.TextEditorProperties.TextRenderingHint; if (updateMargin != null) { updateMargin.Paint(g, updateMargin.DrawingPosition); // clipRectangle.Intersect(updateMargin.DrawingPosition); } if (clipRectangle.Width <= 0 || clipRectangle.Height <= 0) { return; } foreach (AbstractMargin margin in leftMargins) { if (margin.IsVisible) { Rectangle marginRectangle = new Rectangle(currentXPos, currentYPos, margin.Size.Width, Height - currentYPos); if (marginRectangle != margin.DrawingPosition) { // margin changed size if (!isFullRepaint && !clipRectangle.Contains(marginRectangle)) { Invalidate(); // do a full repaint } adjustScrollBars = true; margin.DrawingPosition = marginRectangle; } currentXPos += margin.DrawingPosition.Width; if (clipRectangle.IntersectsWith(marginRectangle)) { marginRectangle.Intersect(clipRectangle); if (!marginRectangle.IsEmpty) { margin.Paint(g, marginRectangle); } } } } Rectangle textViewArea = new Rectangle(currentXPos, currentYPos, Width - currentXPos, Height - currentYPos); if (textViewArea != textView.DrawingPosition) { adjustScrollBars = true; textView.DrawingPosition = textViewArea; // update caret position (but outside of WM_PAINT!) BeginInvoke((MethodInvoker)caret.UpdateCaretPosition); } if (clipRectangle.IntersectsWith(textViewArea)) { textViewArea.Intersect(clipRectangle); if (!textViewArea.IsEmpty) { textView.Paint(g, textViewArea); } } if (adjustScrollBars) { this.motherTextAreaControl.AdjustScrollBars(); } // we cannot update the caret position here, it's not allowed to call the caret API inside WM_PAINT //Caret.UpdateCaretPosition(); base.OnPaint(e); }
public void DrawLine(System.Windows.Forms.PaintEventArgs e, Point locationstart, Point locationend) { e.Graphics.DrawLine(this.linecolor, locationstart, locationend); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { using (var b = new sd.SolidBrush(ForeColor)) { if (Wrap == WrapMode.Character) { // draw string one line at a time to trim to character.. int charactersFitted, linesFilled; string text = Text; sd.PointF drawPoint = sd.PointF.Empty; var font = Font; var height = font.GetHeight(e.Graphics); while (!string.IsNullOrEmpty(text)) { e.Graphics.MeasureString(text, font, Bounds.Size, stringFormat, out charactersFitted, out linesFilled); e.Graphics.DrawString(text.Substring(0, charactersFitted), font, b, drawPoint, stringFormat); if (charactersFitted >= text.Length) { break; } text = text.Substring(charactersFitted); drawPoint.Y += height; } } else { var rect = new sd.RectangleF(Margin.Left, Margin.Top, Bounds.Width - Margin.Horizontal, Bounds.Height - Margin.Vertical); var size = e.Graphics.MeasureString(Text, Font, (int)rect.Width, stringFormat); if (size.Height < rect.Height) { switch (VerticalAlign) { case Eto.Forms.VerticalAlign.Bottom: rect.Y += rect.Height - size.Height; rect.Height = size.Height; break; case Eto.Forms.VerticalAlign.Middle: rect.Y += (rect.Height - size.Height) / 2; rect.Height = size.Height; break; } } if (size.Width < rect.Width) { switch (HorizontalAlign) { case HorizontalAlign.Right: rect.X = rect.Width - size.Width - Margin.Top; rect.Width = size.Width; break; case HorizontalAlign.Center: rect.X = (rect.Width - size.Width) / 2 - Margin.Top; rect.Width = size.Width; break; } } e.Graphics.DrawString(Text, Font, b, rect, stringFormat); } } }
/* public void drawLoop(object sender, System.Windows.Forms.PaintEventArgs e) * { * e.Graphics.FillEllipse(brLoop, 383, 281, 40, 40); * e.Graphics.FillEllipse(brBLK, 400, 295, 10, 10); * }*/ public void carDrawUp_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Point P1 = new Point(25, 8); Point P2 = new Point(28, 3); Point PS1 = new Point(31, 1); Point PS2 = new Point(48, 1); Point P3 = new Point(52, 3); Point P4 = new Point(55, 8); Point P5 = new Point(55, 23); Point P6 = new Point(57, 25); Point P7 = new Point(57, 30); Point P8 = new Point(55, 33); Point P9 = new Point(55, 50); Point P10 = new Point(57, 55); Point P11 = new Point(57, 60); Point P12 = new Point(55, 63); Point PS9 = new Point(55, 63); Point PS10 = new Point(57, 68); Point PS11 = new Point(57, 73); Point PS12 = new Point(55, 76); Point P13 = new Point(55, 87); Point P14 = new Point(48, 89); Point P15 = new Point(33, 89); Point P16 = new Point(25, 87); Point P17 = new Point(25, 63); Point P18 = new Point(23, 60); Point P19 = new Point(23, 55); Point P20 = new Point(25, 50); Point PS17 = new Point(25, 76); Point PS18 = new Point(23, 73); Point PS19 = new Point(23, 68); Point PS20 = new Point(25, 63); Point P21 = new Point(25, 33); Point P22 = new Point(23, 30); Point P23 = new Point(23, 25); Point P24 = new Point(25, 23); Point aP1 = new Point(28, 18); Point aP2 = new Point(34, 14); Point aP3 = new Point(46, 14); Point aP4 = new Point(52, 18); Point aP5 = new Point(52, 30); Point aP6 = new Point(28, 30); Point aP7 = new Point(52, 50); Point aP8 = new Point(28, 50); Point aP9 = new Point(50, 53); Point aP10 = new Point(50, 83); Point aP11 = new Point(47, 86); Point aP12 = new Point(33, 86); Point aP13 = new Point(30, 83); Point aP14 = new Point(30, 53); //array Point[] PA = { P1, P2, PS1, PS2, P3, P4, P8, P13, P14, P15, P16, P1 }; Point[] WR0 = { P5, P6, P7, P8, P5 }; Point[] WL0 = { P21, P22, P23, P24, P21 }; Point[] WR1 = { P9, P10, P11, P12, P9 }; Point[] WR2 = { PS9, PS10, PS11, PS12, PS9 }; Point[] WL1 = { P17, P18, P19, P20, P17 }; Point[] WL2 = { PS17, PS18, PS19, PS20, PS17 }; Point[] PA2 = { aP1, aP2, aP3, aP4, aP5, aP6, aP1 }; Point[] PA3 = { aP6, aP8, aP7, aP5, aP6 }; Point[] PA4 = { aP9, aP10, aP11, aP12, aP13, aP14, aP9 }; //color var p = sender as Panel; var g = e.Graphics; g.FillPolygon(brRED, PA); g.FillPolygon(brDSG, PA2); g.FillPolygon(brRED, PA3); g.FillPolygon(brBLK, PA4); g.FillPolygon(brDMG, WR0); g.FillPolygon(brDMG, WR1); g.FillPolygon(brDMG, WR2); g.FillPolygon(brDMG, WL0); g.FillPolygon(brDMG, WL1); g.FillPolygon(brDMG, WL2); //skeleton e.Graphics.DrawLines(drawPen, PA); e.Graphics.DrawLines(drawPen, WR0); e.Graphics.DrawLines(drawPen, WL0); e.Graphics.DrawLines(drawPen, WR1); e.Graphics.DrawLines(drawPen, WR2); e.Graphics.DrawLines(drawPen, WL1); e.Graphics.DrawLines(drawPen, WL2); e.Graphics.DrawLines(drawPen, PA2); e.Graphics.DrawLines(drawPen, PA3); e.Graphics.DrawLines(drawPen, PA4); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param> protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Graphics G = e.Graphics; Bar = new Rectangle(10, 10, Width - 21, Height - 21); G.Clear(Parent.FindForm().BackColor); G.SmoothingMode = SmoothingMode.AntiAlias; DesignFunctions.PillStyle styles = new DesignFunctions.PillStyle(); styles.Left = true; styles.Right = true; //Background LinearGradientBrush BackLinear = new LinearGradientBrush(new Point(0, Convert.ToInt32((Height / 2) - (Track.Height / 2))), new Point(0, Convert.ToInt32((Height / 2) + (Track.Height / 2))), Color.FromArgb(50, Color.Black), Color.Transparent); //G.FillPath(BackLinear, RoundRect(0, CInt((Height / 2) - 4), Width - 1, 8, 3)) G.FillPath(BackLinear, (GraphicsPath)DesignFunctions.Pill(0, Convert.ToInt32(Height / 2 - Track.Height / 2), Width - 1, Track.Height - 2, new DesignFunctions.PillStyle { Left = true, Right = true })); G.FillPath(BackLinear, (GraphicsPath)DesignFunctions.Pill(0, Convert.ToInt32(Height / 2 - Track.Height / 2), Width - 1, Track.Height - 2, new DesignFunctions.PillStyle { Left = true, Right = true })); G.DrawPath(DesignFunctions.ToPen(50, Color.Black), (GraphicsPath)DesignFunctions.Pill(0, Convert.ToInt32(Height / 2 - Track.Height / 2), Width - 1, Track.Height - 2, new DesignFunctions.PillStyle { Left = true, Right = true })); BackLinear.Dispose(); //Fill if (ToggleLocation > 0) { G.FillPath(new LinearGradientBrush(new Point(0, Convert.ToInt32((Height / 2) - Track.Height / 2)), new Point(1, Convert.ToInt32((Height / 2) + Track.Height / 2)), Color.FromArgb(250, 200, 70), Color.FromArgb(250, 160, 40)), (GraphicsPath)DesignFunctions.Pill(1, Convert.ToInt32((Height / 2) - Track.Height / 2), Convert.ToInt32(Bar.Width * (ToggleLocation / 100)) + Convert.ToInt32(Track.Width / 2), Track.Height - 3, new DesignFunctions.PillStyle { Left = true, Right = true })); G.DrawPath(DesignFunctions.ToPen(100, Color.White), (GraphicsPath)DesignFunctions.Pill(1, Convert.ToInt32((Height / 2) - Track.Height / 2 + 1), Convert.ToInt32(Bar.Width * (ToggleLocation / 100)) + Convert.ToInt32(Track.Width / 2), Track.Height - 5, new DesignFunctions.PillStyle { Left = true, Right = true })); } if (Toggled) { G.DrawString("ON", new Font("Arial", 6, FontStyle.Bold), DesignFunctions.ToBrush(150, Color.Black), new Rectangle(0, -1, Width - Track.Width + Track.Width / 3, Height), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } else { G.DrawString("OFF", new Font("Arial", 6, FontStyle.Bold), DesignFunctions.ToBrush(150, Color.Black), new Rectangle(Track.Width - Track.Width / 3, -1, Width - Track.Width + Track.Width / 3, Height), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } //Button G.FillEllipse(Brushes.White, Bar.X + Convert.ToInt32(Bar.Width * (ToggleLocation / 100)) - Convert.ToInt32(Track.Width / 2), Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2), Track.Width, Track.Height); G.DrawEllipse(DesignFunctions.ToPen(50, Color.Black), Bar.X + Convert.ToInt32(Bar.Width * (ToggleLocation / 100) - Convert.ToInt32(Track.Width / 2)), Bar.Y + Convert.ToInt32((Bar.Height / 2)) - Convert.ToInt32(Track.Height / 2), Track.Width, Track.Height); }
public void OnPaint(object sender, PaintEventArgs e) { drawRuler(e.Graphics, 10, theSize - 1 + 10, 8); }
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { }
public override void PrintYourself(System.Windows.Forms.PaintEventArgs e) => e.Graphics.DrawImage(image, X, Y);
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; KnownColor[] a = new KnownColor[] { KnownColor.ActiveBorder, KnownColor.ActiveCaption, KnownColor.ActiveCaptionText, KnownColor.AliceBlue, KnownColor.AntiqueWhite, KnownColor.AppWorkspace, KnownColor.Aqua, KnownColor.Aquamarine, KnownColor.Azure, KnownColor.Beige, KnownColor.Bisque, KnownColor.Black, KnownColor.BlanchedAlmond, KnownColor.Blue, KnownColor.BlueViolet, KnownColor.Brown, KnownColor.BurlyWood, KnownColor.CadetBlue, KnownColor.Chartreuse, KnownColor.Chocolate, KnownColor.Control, KnownColor.ControlDark, KnownColor.ControlDarkDark, KnownColor.ControlLight, KnownColor.ControlLightLight, KnownColor.ControlText, KnownColor.Coral, KnownColor.CornflowerBlue, KnownColor.Cornsilk, KnownColor.Crimson, KnownColor.Cyan, KnownColor.DarkBlue, KnownColor.DarkCyan, KnownColor.DarkGoldenrod, KnownColor.DarkGray, KnownColor.DarkGreen, KnownColor.DarkKhaki, KnownColor.DarkMagenta, KnownColor.DarkOliveGreen, KnownColor.DarkOrange, KnownColor.DarkOrchid, KnownColor.DarkRed, KnownColor.DarkSalmon, KnownColor.DarkSeaGreen, KnownColor.DarkSlateBlue, KnownColor.DarkSlateGray, KnownColor.DarkTurquoise, KnownColor.DarkViolet, KnownColor.DeepPink, KnownColor.DeepSkyBlue, KnownColor.Desktop, KnownColor.DimGray, KnownColor.DodgerBlue, KnownColor.Firebrick, KnownColor.FloralWhite, KnownColor.ForestGreen, KnownColor.Fuchsia, KnownColor.Gainsboro, KnownColor.GhostWhite, KnownColor.Gold, KnownColor.Goldenrod, KnownColor.Gray, KnownColor.GrayText, KnownColor.Green, KnownColor.GreenYellow, KnownColor.Highlight, KnownColor.HighlightText, KnownColor.Honeydew, KnownColor.HotPink, KnownColor.HotTrack, KnownColor.InactiveBorder, KnownColor.InactiveCaption, KnownColor.InactiveCaptionText, KnownColor.IndianRed, KnownColor.Indigo, KnownColor.Info, KnownColor.InfoText, KnownColor.Ivory, KnownColor.Khaki, KnownColor.Lavender, KnownColor.LavenderBlush, KnownColor.LawnGreen, KnownColor.LemonChiffon, KnownColor.LightBlue, KnownColor.LightCoral, KnownColor.LightCyan, KnownColor.LightGoldenrodYellow, KnownColor.LightGray, KnownColor.LightGreen, KnownColor.LightPink, KnownColor.LightSalmon, KnownColor.LightSeaGreen, KnownColor.LightSkyBlue, KnownColor.LightSlateGray, KnownColor.LightSteelBlue, KnownColor.LightYellow, KnownColor.Lime, KnownColor.LimeGreen, KnownColor.Linen, KnownColor.Magenta, KnownColor.Maroon, KnownColor.MediumAquamarine, KnownColor.MediumBlue, KnownColor.MediumOrchid, KnownColor.MediumPurple, KnownColor.MediumSeaGreen, KnownColor.MediumSlateBlue, KnownColor.MediumSpringGreen, KnownColor.MediumTurquoise, KnownColor.MediumVioletRed, KnownColor.Menu, KnownColor.MenuText, KnownColor.MidnightBlue, KnownColor.MintCream, KnownColor.MistyRose, KnownColor.Moccasin, KnownColor.NavajoWhite, KnownColor.Navy, KnownColor.OldLace, KnownColor.Olive, KnownColor.OliveDrab, KnownColor.Orange, KnownColor.OrangeRed, KnownColor.Orchid, KnownColor.PaleGoldenrod, KnownColor.PaleGreen, KnownColor.PaleTurquoise, KnownColor.PaleVioletRed, KnownColor.PapayaWhip, KnownColor.PeachPuff, KnownColor.Peru, KnownColor.Pink, KnownColor.Plum, KnownColor.PowderBlue, KnownColor.Purple, KnownColor.Red, KnownColor.RosyBrown, KnownColor.RoyalBlue, KnownColor.SaddleBrown, KnownColor.Salmon, KnownColor.SandyBrown, KnownColor.ScrollBar, KnownColor.SeaGreen, KnownColor.SeaShell, KnownColor.Sienna, KnownColor.Silver, KnownColor.SkyBlue, KnownColor.SlateBlue, KnownColor.SlateGray, KnownColor.Snow, KnownColor.SpringGreen, KnownColor.SteelBlue, KnownColor.Tan, KnownColor.Teal, KnownColor.Thistle, KnownColor.Tomato, KnownColor.Transparent, KnownColor.Turquoise, KnownColor.Violet, KnownColor.Wheat, KnownColor.White, KnownColor.WhiteSmoke, KnownColor.Window, KnownColor.WindowFrame, KnownColor.WindowText, KnownColor.Yellow, KnownColor.YellowGreen, }; int x = 0, y = 0, cx = 5; int h = Font.Height * 4 / 2; int w = Width / cx; for (int i = 0; i < a.Length; i++) { Color bc = Color.FromKnownColor(a[i]); if (bc.IsSystemColor == true) // True:색상, False:시스템색상 { continue; } Rectangle r = new Rectangle(x * w, y * h, w, h); g.FillRectangle(new SolidBrush(Color.FromKnownColor(a[i])), r); SizeF sa = g.MeasureString(a[i].ToString(), Font); Rectangle tr = new Rectangle(r.X, r.Y, (int)sa.Width + 1, (int)sa.Height + 2); g.FillRectangle(Brushes.White, tr); tr.Offset(0, 2); g.DrawString(a[i].ToString(), Font, Brushes.Black, tr); g.DrawRectangle(Pens.Black, r); x++; if (x == cx) { y++; x = 0; } // 색상이름을 가운데 정렬로 표시 // Color bc = Color.FromKnownColor((KnownColor)i); // if (bc.IsSystemColor == false) // continue; // // Rectangle r = new Rectangle(x * w, y * h, w, h); // StringFormat sf = new StringFormat(); // sf.Alignment = StringAlignment.Center; // 수평 정렬 // sf.LineAlignment = StringAlignment.Center; // 수직 정렬 // // g.FillRectangle(new SolidBrush(bc), r); // g.DrawRectangle(Pens.Black, r); // // Color fc1 = bc.GetBrightness() >= 0.5 ? Color.Black : Color.White; // g.DrawString(((KnownColor)i).ToString(), Font, new SolidBrush(fc1), r, sf); // x++; // if (x == cx) // { // y++; // x = 0; // } } if (x != 0) { y++; } Height = (y * h) + 1;// + (Height - ClientSize.Height); }
public int GetWidthTextPart(System.Windows.Forms.PaintEventArgs e, int startpos, int textlength) { SizeF sizef = e.Graphics.MeasureString(this.text.Substring(startpos, textlength), this.font); return Convert.ToInt32(sizef.Width); }
public void Draw(System.Windows.Forms.PaintEventArgs e, Point location) { e.Graphics.DrawString(this.text, this.font, this.textcolor, location); }
private void PictureBoxAfter_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { ShowGradient(e.Graphics, 0, 0.5F, 0.5F); ShowGradient(e.Graphics, TrackBarTextHue.Value, Convert.ToSingle(TrackBarTextSaturation.Value) / 200.0F + 0.5F, Convert.ToSingle(TrackBarTextLightness.Value) / 200.0F + 0.5F); }
public void DrawPart(System.Windows.Forms.PaintEventArgs e, Point location, int start, int length) { e.Graphics.DrawString(this.text.Substring(start, length), this.font, this.textcolor, location); }
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent) { }
//Overrides protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); DrawLines(e.Graphics); DrawSlider(e.Graphics); }
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e) { e.Graphics.FillRectangle(Brushes.White, new Rectangle(0, 0, Width, Height)); }
public void OnPaint(object sender, PaintEventArgs e) { e.Graphics.Clear(Color.Gray); DrawSpace(e.Graphics, theSize / 2 + 10, theSize / 2 + 30, theSize); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); ControlPaint.DrawBorder3D(e.Graphics, this.ClientRectangle, Border3DStyle.Raised); }
//ComponentFactory Palette Painting protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { //Define Bounds Rectangle ButtonBounds = new Rectangle(0, 0, 16, 16); RectangleF ButtonCircleBounds = new RectangleF((float)0, (float)0, (float)15.1, (float)15.1); //Smoothing Mode e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; //Paint Base base.OnPaint(e); if (_palette != null) { //Get the renderer associated with this palette IRenderer Renderer = _palette.GetRenderer(); //Create the rendering context that is passed into all renderer calls using (RenderContext RenderContext = new RenderContext(this, e.Graphics, ButtonBounds, Renderer)) { // Set the style we want picked up from the base palette m_paletteBack.Style = PaletteBackStyle.HeaderPrimary; //Fill The Space using (GraphicsPath Path = GetButtonPath(ButtonBounds)) { // Ask renderer to draw the background m_mementoBack1 = Renderer.RenderStandardBack.DrawBack(RenderContext, ButtonBounds, Path, m_paletteBack, m_orientation, (this.Enabled ? PaletteState.Normal : PaletteState.Disabled), m_mementoBack1); } // We want the inner part of the control to act like a button, so // we need to find the correct palette state based on if the mouse // is over the control if the mouse button is pressed down or not. PaletteState ButtonState = GetButtonState(); // Set the style of button we want to draw m_paletteBack.Style = m_visuallook; m_paletteBorder.Style = (PaletteBorderStyle)m_visuallook; m_paletteContent.Style = (PaletteContentStyle)m_visuallook; // Do we need to draw the background? if (m_paletteBack.GetBackDraw(ButtonState) == InheritBool.True) { using (GraphicsPath Path = GetRoundedSquarePath(ButtonCircleBounds)) { // Ask renderer to draw the background m_mementoBack2 = Renderer.RenderStandardBack.DrawBack(RenderContext, ButtonBounds, Path, m_paletteBack, m_orientation, ButtonState, m_mementoBack2); } } // Do we need to draw the border? if (m_paletteBorder.GetBorderDraw(ButtonState) == InheritBool.True) { // Now we draw the border of the inner area, also in ButtonStandalone style e.Graphics.DrawEllipse(new Pen(m_paletteBorder.GetBorderColor2(ButtonState)), ButtonCircleBounds); } e.Graphics.SmoothingMode = SmoothingMode.None; //Draw Magnifying Sign switch (m_buttonstyle) { case ButtonStyles.MinusButton: Rectangle MinusOuterBounds = new Rectangle(3, (this.Height / 2) - 2, 10, 4); Rectangle MinusInnerBounds = new Rectangle(4, (this.Height / 2) - 1, 8, 2); e.Graphics.FillRectangle(new SolidBrush(m_outerColor), MinusOuterBounds); e.Graphics.FillRectangle(new SolidBrush(m_innerColor), MinusInnerBounds); break; case ButtonStyles.PlusButton: DrawPlusOuter(e.Graphics, m_outerColor); DrawPlusInner(e.Graphics, m_innerColor); break; } } } }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { this.Render(); // Render on painting }
private void drawarea_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { mydraw(); }
private void MainForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { // Create string to draw. String drawStringline = "Draw line"; String drawStringellipse = "Draw Ellipse"; String drawStringFillellipse = "Draw Fill Ellipse"; String drawStringcurve = "Draw closed curve"; //String drawStringellipse = "Draw ellipse"; //String drawStringellipse = "Draw ellipse"; //String drawStringellipse = "Draw ellipse"; //String drawStringellipse = "Draw ellipse"; //create a graphics object from the form Graphics g = this.CreateGraphics(); // Create font and brush. Pen blackPen = new Pen(Color.Black); Font drawFont = new Font("Arial", 16); SolidBrush drawBrush = new SolidBrush(Color.Black); SolidBrush drawBrushObj = new SolidBrush(Color.Blue); Pen p = new Pen(Color.Red, 2); //*----------Drawing line-------------* RectangleF drawRect1 = new RectangleF(5.0f, 5.0f, 100.0f, 25.0f); // Draw rectangle to screen. g.DrawRectangle(blackPen, 5.0f, 5.0f, 100.0f, 25.0f); // Draw string to screen. g.DrawString(drawStringline, drawFont, drawBrush, drawRect1); // create a pen object with which to draw // draw the line // call a member of the graphics class g.DrawLine(p, 5, 40, 100, 40); //*----------Draw ellipse-------------* RectangleF drawRect2 = new RectangleF(115.0f, 5.0f, 150.0f, 25.0f); // Draw rectangle to screen. g.DrawRectangle(blackPen, 115.0f, 5.0f, 150.0f, 25.0f); // Draw string to screen. g.DrawString(drawStringellipse, drawFont, drawBrush, drawRect2); // create a pen object with which to draw Rectangle rect = new Rectangle(150, 35, 100, 50); // Draw ellipse to screen. g.DrawEllipse(p, rect); //*----------Draw Fill ellipse-------------* RectangleF drawRect3 = new RectangleF(275.0f, 5.0f, 175.0f, 25.0f); // Draw rectangle to screen. g.DrawRectangle(blackPen, 275.0f, 5.0f, 175.0f, 25.0f); // Draw string to screen. g.DrawString(drawStringFillellipse, drawFont, drawBrush, drawRect3); // Fill ellipse on screen. g.FillEllipse(drawBrushObj, 275, 35, 150, 50); //*---------Draw closed Curve--------------* RectangleF drawRect4 = new RectangleF(460.0f, 5.0f, 200.0f, 25.0f); // Draw rectangle to screen. g.DrawRectangle(blackPen, 460.0f, 5.0f, 200.0f, 25.0f); // Draw string to screen. g.DrawString(drawStringcurve, drawFont, drawBrush, drawRect4); // Create points that define curve. Point point1 = new Point(470, 45); Point point2 = new Point(500, 85); Point point3 = new Point(530, 125); Point point4 = new Point(560, 150); Point point5 = new Point(590, 125); Point point6 = new Point(620, 100); Point point7 = new Point(650, 45); Point[] curvePoints = { point1, point2, point3, point4, point5, point6, point7 }; // Draw closed curve to screen. g.DrawClosedCurve(p, curvePoints); }
public void carDrawRight_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Point P1 = new Point(82, 25); Point P2 = new Point(87, 28); Point PS1 = new Point(89, 31); Point PS2 = new Point(89, 48); Point P3 = new Point(87, 52); Point P4 = new Point(82, 55); Point P5 = new Point(67, 55); Point P6 = new Point(65, 57); Point P7 = new Point(60, 57); Point P8 = new Point(57, 55); Point P9 = new Point(40, 55); Point P10 = new Point(35, 57); Point P11 = new Point(30, 57); Point P12 = new Point(27, 55); Point PS9 = new Point(27, 55); Point PS10 = new Point(22, 57); Point PS11 = new Point(17, 57); Point PS12 = new Point(14, 55); Point P13 = new Point(3, 55); Point P14 = new Point(1, 48); Point P15 = new Point(1, 33); Point P16 = new Point(3, 25); Point P17 = new Point(27, 25); Point P18 = new Point(30, 23); Point P19 = new Point(35, 23); Point P20 = new Point(40, 25); Point PS17 = new Point(14, 25); Point PS18 = new Point(17, 23); Point PS19 = new Point(22, 23); Point PS20 = new Point(27, 25); Point P21 = new Point(57, 25); Point P22 = new Point(60, 23); Point P23 = new Point(65, 23); Point P24 = new Point(67, 25); Point aP1 = new Point(72, 28); Point aP2 = new Point(76, 34); Point aP3 = new Point(76, 46); Point aP4 = new Point(72, 52); Point aP5 = new Point(60, 52); Point aP6 = new Point(60, 28); Point aP7 = new Point(40, 52); Point aP8 = new Point(40, 28); Point aP9 = new Point(37, 50); Point aP10 = new Point(7, 50); Point aP11 = new Point(4, 47); Point aP12 = new Point(4, 33); Point aP13 = new Point(7, 30); Point aP14 = new Point(37, 30); //array Point[] PA = { P1, P2, PS1, PS2, P3, P4, P8, P13, P14, P15, P16, P1 }; Point[] WR0 = { P5, P6, P7, P8, P5 }; Point[] WL0 = { P21, P22, P23, P24, P21 }; Point[] WR1 = { P9, P10, P11, P12, P9 }; Point[] WR2 = { PS9, PS10, PS11, PS12, PS9 }; Point[] WL1 = { P17, P18, P19, P20, P17 }; Point[] WL2 = { PS17, PS18, PS19, PS20, PS17 }; Point[] PA2 = { aP1, aP2, aP3, aP4, aP5, aP6, aP1 }; Point[] PA3 = { aP6, aP8, aP7, aP5, aP6 }; Point[] PA4 = { aP9, aP10, aP11, aP12, aP13, aP14, aP9 }; //color var p = sender as Panel; var g = e.Graphics; g.FillPolygon(brRED, PA); g.FillPolygon(brDSG, PA2); g.FillPolygon(brRED, PA3); g.FillPolygon(brBLK, PA4); g.FillPolygon(brDMG, WR0); g.FillPolygon(brDMG, WR1); g.FillPolygon(brDMG, WR2); g.FillPolygon(brDMG, WL0); g.FillPolygon(brDMG, WL1); g.FillPolygon(brDMG, WL2); //skeleton e.Graphics.DrawLines(drawPen, PA); e.Graphics.DrawLines(drawPen, WR0); e.Graphics.DrawLines(drawPen, WL0); e.Graphics.DrawLines(drawPen, WR1); e.Graphics.DrawLines(drawPen, WR2); e.Graphics.DrawLines(drawPen, WL1); e.Graphics.DrawLines(drawPen, WL2); e.Graphics.DrawLines(drawPen, PA2); e.Graphics.DrawLines(drawPen, PA3); e.Graphics.DrawLines(drawPen, PA4); }
private void SplashForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawImage(m_bmp, 0, 0); }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(Color.Black); }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; if ((!Hovered) || !Enabled) { currentBackColor = MathHelper.ColorLerp(currentBackColor, NormalColor, 5); g.FillRectangle(new SolidBrush(currentBackColor), 0, 0, Width, Height); g.DrawRectangle(new Pen(NormalBorderColor), 0, 0, Width, Height); } else { currentBackColor = MathHelper.ColorLerp(currentBackColor, HoverColor, 5); g.FillRectangle(new SolidBrush(currentBackColor), 0, 0, Width, Height); g.DrawRectangle(new Pen(HoverBorderColor), 0, 0, Width, Height); } SolidBrush textBrush = new SolidBrush(ForeColor); if (!Enabled) { textBrush.Color = ForeColor + Color.FromArgb(0, 128, 128, 128); } if (Image != null && Image.uTexture != null) { var imageToPaint = Image; var imageColorToPaint = ImageColor; if (Hovered) { if (ImageHover != null) { imageToPaint = ImageHover; } if (ImageHoverColor != null) { imageColorToPaint = ImageHoverColor.Value; } } switch (BackgroundImageLayout) { default: case ImageLayout.None: g.DrawTexture(imageToPaint, 0, 0, Image.Width, Image.Height, imageColorToPaint); break; case ImageLayout.Center: g.DrawTexture(imageToPaint, Width / 2 - Image.Width / 2, Height / 2 - Image.Height / 2, Image.Width, Image.Height, imageColorToPaint); break; case ImageLayout.Stretch: g.DrawTexture(imageToPaint, 0, 0, Width, Height, imageColorToPaint); break; case ImageLayout.Zoom: // TODO: not working. break; } } g.DrawString(Text, Font, textBrush, Padding.Left, Padding.Top, Width - Padding.Left - Padding.Right, Height - Padding.Top - Padding.Bottom, TextAlign); }
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e) { SolidBrush sb = new SolidBrush(Parent.BackColor); e.Graphics.FillRectangle(sb, this.ClientRectangle); }
private void PictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawImage(Bitmap, 0, 0, 200, 200); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); GraphicsPath GP_MinimizeRect = new GraphicsPath(); GraphicsPath GP_CloseRect = new GraphicsPath(); GP_MinimizeRect.AddRectangle(MinimizeRect); GP_CloseRect.AddRectangle(CloseRect); G.Clear(BackColor); switch (State) { case MouseState.None: { LinearGradientBrush MinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90); G.FillPath(MinimizeGradient, GP_MinimizeRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect); G.DrawString("0", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16); LinearGradientBrush CloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90); G.FillPath(CloseGradient, GP_CloseRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect); G.DrawString("r", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16); break; } case MouseState.Over: { if (i > 0 && i < 28) { LinearGradientBrush MinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90); G.FillPath(MinimizeGradient, GP_MinimizeRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect); G.DrawString("0", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16); LinearGradientBrush CloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90); G.FillPath(CloseGradient, GP_CloseRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect); G.DrawString("r", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16); } else if (i > 30 && i < 75) { LinearGradientBrush CloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90); G.FillPath(CloseGradient, GP_CloseRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect); G.DrawString("r", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16); LinearGradientBrush MinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90); G.FillPath(MinimizeGradient, RoundRectangle.RoundRect(MinimizeRect, 1)); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect); G.DrawString("0", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16); } else { LinearGradientBrush MinimizeGradient = new LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90); G.FillPath(MinimizeGradient, GP_MinimizeRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect); G.DrawString("0", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16); LinearGradientBrush CloseGradient = new LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90); G.FillPath(CloseGradient, GP_CloseRect); G.DrawPath(new Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect); G.DrawString("r", new Font("Marlett", 11F, FontStyle.Regular), new SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16); } break; } } e.Graphics.DrawImage((Image)B.Clone(), 0, 0); G.Dispose(); GP_CloseRect.Dispose(); GP_MinimizeRect.Dispose(); B.Dispose(); }
private void PictureBoxBefore_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { ShowGradient(e.Graphics, 0, 0.5F, 0.5F); }