当前位置: 首页>>代码示例>>C#>>正文


C# Pen.Dispose方法代码示例

本文整理汇总了C#中Pen.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Pen.Dispose方法的具体用法?C# Pen.Dispose怎么用?C# Pen.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pen的用法示例。


在下文中一共展示了Pen.Dispose方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawDocumentGridLines

            public static void DrawDocumentGridLines(Graphics graphics, Rectangle rectangle, int gridSpacing)
            {
                Pen LinePen = new Pen(DefaultGridLineColor);

                for (int OffsetX = 0; OffsetX < rectangle.Width; OffsetX += gridSpacing)
                {
                    graphics.DrawLine(LinePen, new Point(OffsetX, 0), new Point(OffsetX, rectangle.Height));
                }

                for (int OffsetY = 0; OffsetY < rectangle.Height; OffsetY += gridSpacing)
                {
                    graphics.DrawLine(LinePen, new Point(0, OffsetY), new Point(rectangle.Width, OffsetY));
                }

                LinePen.Dispose();
            }
开发者ID:ArchangelNexus,项目名称:Abstract-Design-Utility,代码行数:16,代码来源:StyleHelper.cs

示例2: dd

    public void dd()
    {
        SolidBrush Brush_tilte = new SolidBrush(Color.Red);
            SolidBrush Brush_front = new SolidBrush(Color.Black);
            System.Drawing.Graphics g = panel1.CreateGraphics();
            Font drawFont = new Font("Arial", 8);
            System.Drawing.Point titleLocation = new System.Drawing.Point(6, 6);
            g.DrawString("尺寸链校核", drawFont, Brush_tilte, titleLocation);
            Pen pg = new Pen(Color.Green,2);
            g.DrawLine(pg, 520, 10, 538, 10);
            Pen pr = new Pen(Color.Red,2);
            g.DrawLine(pr, 520, 22, 538, 22);
            System.Drawing.Point LineLocation1 = new System.Drawing.Point(550, 5);
            g.DrawString("增环", drawFont, Brush_front, LineLocation1);
            System.Drawing.Point LineLocation2 = new System.Drawing.Point(550, 17);
            g.DrawString("减环", drawFont, Brush_front, LineLocation2);

            pg.Dispose();
            pr.Dispose();

            Brush_tilte.Dispose();
            Brush_front.Dispose();
    }
开发者ID:jerryhethatday,项目名称:410proj,代码行数:23,代码来源:form1.cs

示例3: DrawArrow

    private void DrawArrow(Color color, int rx, int ry)
    {
        Rectangle R = new Rectangle(rx + 8, ry + 8, 16, 16);
        G.SmoothingMode = SmoothingMode.AntiAlias;

        Pen P = new Pen(color, 1);
        AdjustableArrowCap C = new AdjustableArrowCap(3, 2);
        P.CustomEndCap = C;

        G.DrawArc(P, R, 0f, 290f);

        P.Dispose();
        C.Dispose();
        G.SmoothingMode = SmoothingMode.None;
    }
开发者ID:massimoca,项目名称:Wedit,代码行数:15,代码来源:Theme.cs

示例4: DrawLines

            // ===================================================================
            protected void DrawLines(ref Graphics g)
            {
                foreach (Line line in m_Lines)
                {
                    if (line.m_MagnitudeList.Count == 0)
                    {
                        //TODO: This may not be nescessary, so look into it.
                        /* No push points to draw */
                        return;
                    }

                    if (!line.m_bVisible)
                    {
                        continue;
                    }

                    /* Now prepare to draw the line or bar */

                    Pen linePen = new Pen(line.m_Color, line.m_Thickness);

                    Point lastPoint = new Point();
                    lastPoint.X = m_OffsetX;
                    lastPoint.Y = Height - ((line.m_MagnitudeList[0] *
                       Height) / (m_MaxPeek - m_MinPeek));

                    for (int n = 0; n < line.m_MagnitudeList.Count; ++n)
                    {
                        if (line.m_bShowAsBar)
                        {
                            /* The line is set to be shown as a bar graph, so
                            first we get the bars rectangle, then draw the bar */

                            Rectangle barRect = new Rectangle();

                            // Weird hack because BarRect.Location.* causes error
                            Point p = barRect.Location;
                            p.X = m_OffsetX + (n * m_LineInterval) + 1;
                            p.Y = Height - ((line.m_MagnitudeList[n] * Height) /
                                                (m_MaxPeek - m_MinPeek));
                            barRect.Location = p;

                            barRect.Width = m_LineInterval - 1;
                            barRect.Height = Height;

                            DrawBar(barRect, line, ref g);
                        }
                        else
                        {
                            /* Draw a line */

                            int newX = m_OffsetX + (n * m_LineInterval);
                            int newY = Height - ((line.m_MagnitudeList[n] * Height) /
                                (m_MaxPeek - m_MinPeek));

                            g.DrawLine(linePen, lastPoint.X, lastPoint.Y, newX, newY);

                            lastPoint.X = newX;
                            lastPoint.Y = newY;
                        }
                    }

                    linePen.Dispose();
                }
            }
开发者ID:hjgode,项目名称:VMusage,代码行数:65,代码来源:2DPushGraph.cs

示例5: DrawGrid

            // ===================================================================
            protected void DrawGrid(ref Graphics g)
            {
                Pen gridPen = new Pen(m_GridColor, 1);
                for (int n = Height - 1; n >= 0; n -= m_GridSize)
                {
                    g.DrawLine(gridPen, m_OffsetX, n, Width, n);
                }

                for (int n = m_OffsetX + m_MoveOffset; n < Width; n += m_GridSize)
                {
                    if (n < m_OffsetX)
                    {
                        continue;
                    }

                    g.DrawLine(gridPen, n, 0, n, Height);
                }

                gridPen.Dispose();
            }
开发者ID:hjgode,项目名称:VMusage,代码行数:21,代码来源:2DPushGraph.cs

示例6: DrawLabels

            // ===================================================================
            protected void DrawLabels(ref Graphics g)
            {
                SizeF maxSize = g.MeasureString(m_MaxLabel, Font);
                SizeF minSize = g.MeasureString(m_MinLabel, Font);

                int textWidth = (int)((maxSize.Width > minSize.Width)
                                ? maxSize.Width
                                : minSize.Width) + 6;

                SolidBrush textBrush = new SolidBrush(m_TextColor);

                /* Draw the labels (max: Top) (min: Bottom) */

                g.DrawString(m_MaxLabel, Font, textBrush,
                              textWidth / 2 - (maxSize.Width / 2),
                              2);

                g.DrawString(m_MinLabel, Font, textBrush,
                              textWidth / 2 - (minSize.Width / 2),
                              Height - minSize.Height - 2);

                textBrush.Dispose();

                /* Draw the bordering line */

                Pen borderPen = new Pen(m_GridColor, 1);
                g.DrawLine(borderPen, textWidth + 6, 0, textWidth + 6, Height);

                borderPen.Dispose();

                /* Update the offset so we don't draw the graph over the labels */
                m_OffsetX = textWidth + 6;
            }
开发者ID:hjgode,项目名称:VMusage,代码行数:34,代码来源:2DPushGraph.cs

示例7: HandlePaint

	private void HandlePaint(Object sender, PaintEventArgs e)
	{
		Graphics graphics = e.Graphics;
		Form form = (sender as Form);
		Rectangle bounds = form.ClientRectangle;

		Pen pen = new Pen(Color.Black, 1.0f);
		graphics.DrawLine(pen, 0, 0, bounds.Width, bounds.Height - 23);
		pen.Dispose();

		pen = new Pen(Color.Red, 2.0f);
		graphics.DrawRectangle
			(pen, 10, 10, bounds.Width - 20, bounds.Height - 40);
		pen.Dispose();

		ControlPaint.DrawFocusRectangle
			(graphics,
			 new Rectangle(15, 15, bounds.Width - 30, bounds.Height - 50));

		Brush brush = new SolidBrush(Color.Yellow);
		graphics.FillPie(brush, 20, 20, 60, 60, 30.0f, 70.0f);
		brush.Dispose();

		Font font = new Font("Arial", 12);
		brush = new SolidBrush(Color.Blue);
		graphics.DrawString("Hello", font, brush, 30, 100);
		brush.Dispose();
		font.Dispose();

		brush = new HatchBrush
			(HatchStyle.BackwardDiagonal, Color.Black, Color.White);
		graphics.FillEllipse(brush, 200, 40, 100, 100);
		brush.Dispose();
	}
开发者ID:hitswa,项目名称:winforms,代码行数:34,代码来源:FormsHello.cs

示例8: DrawGrid

    public void DrawGrid()
    {
        Pen myPen;
        myPen = new Pen(Color.White);
        Graphics formGraphics = simulation.gridPanel.CreateGraphics();

        //drawing cells rows
        foreach (var item in grid.ReturnGridCells())
        {
            formGraphics.DrawLine(myPen, item.ReturnLocation().X, item.ReturnLocation().Y, (item.ReturnLocation().X + 200), item.ReturnLocation().Y);//top line from the left to right
            formGraphics.DrawLine(myPen, item.ReturnLocation().X, item.ReturnLocation().Y, item.ReturnLocation().X, (item.ReturnLocation().Y + 200));//left line from top to bottom
            formGraphics.DrawLine(myPen, item.ReturnLocation().X, (item.ReturnLocation().Y + 199), (item.ReturnLocation().X + 200), item.ReturnLocation().Y + 199);//bottom line from the left to right
            formGraphics.DrawLine(myPen, (item.ReturnLocation().X + 199), item.ReturnLocation().Y, (item.ReturnLocation().X + 199), (item.ReturnLocation().Y + 200));//right line from top to bottom
        }
        myPen.Dispose();
        formGraphics.Dispose();
    }
开发者ID:ProCP-Fontys,项目名称:Simulation,代码行数:17,代码来源:Simulator.cs

示例9: AddLine

    private void AddLine(Graphics graphics1, Rectangle rect)
    {
        int num;
        float width;
        int num2;
        switch (this._lineNoise)
        {
        case CaptchaImage.LineNoiseLevel.None:
        default:
            return;

        case CaptchaImage.LineNoiseLevel.Low:
            num = 4;
            width = Convert.ToSingle((double)this._height / 31.25);
            num2 = 1;
            break;

        case CaptchaImage.LineNoiseLevel.Medium:
            num = 5;
            width = Convert.ToSingle((double)this._height / 27.7777);
            num2 = 1;
            break;

        case CaptchaImage.LineNoiseLevel.High:
            num = 3;
            width = Convert.ToSingle((double)this._height / 25.0);
            num2 = 2;
            break;

        case CaptchaImage.LineNoiseLevel.Extreme:
            num = 3;
            width = Convert.ToSingle((double)this._height / 22.7272);
            num2 = 3;
            break;
        }
        checked
        {
            PointF[] array = new PointF[num + 1];
            Pen pen = new Pen(Color.Black, width);
            int arg_B8_0 = 1;
            int num3 = num2;
            for (int i = arg_B8_0; i <= num3; i++)
            {
                int arg_C0_0 = 0;
                int num4 = num;
                for (int j = arg_C0_0; j <= num4; j++)
                {
                    array[j] = this.RandomPoint(rect);
                }
                graphics1.DrawCurve(pen, array, 1.75f);
            }
            pen.Dispose();
        }
    }
开发者ID:ascvorcov,项目名称:Captcha,代码行数:54,代码来源:CaptchaImage.cs

示例10: DrawLines


//.........这里部分代码省略.........
                    if (!line.m_bVisible)
                    {
                        continue;
                    }

                    if (greatestMCount < line.m_MagnitudeList.Count)
                    {
                        greatestMCount = line.m_MagnitudeList.Count;
                    }
                }

                if (greatestMCount == 0)
                {
                    return; // No lines to draw
                }

                foreach (Line line in m_Lines)
                {

                    /* If the line has less push points than the line with the greatest
                    number of push points, new push points are appended with
                    the same magnitude as the previous push point. If no push points
                    exist for the line, one is added with the least magnitude possible. */

                    if (line.m_MagnitudeList.Count == 0)
                    {
                        line.m_MagnitudeList.Add(m_MinPeek);
                    }

                    while (line.m_MagnitudeList.Count < greatestMCount)
                    {
                        line.m_MagnitudeList.Add(
                            line.m_MagnitudeList[line.m_MagnitudeList.Count - 1]);
                    }

                    while (line.m_MagnitudeList.Count >= m_MaxCoords)
                    {
                        line.m_MagnitudeList.RemoveAt(0);
                    }

                    if (line.m_MagnitudeList.Count == 0)
                    {
                        //TODO: This may not be nescessary, so look into it.
                        /* No push points to draw */
                        return;
                    }

                    if (!line.m_bVisible)
                    {
                        continue;
                    }

                    /* Now prepare to draw the line or bar */

                    Pen linePen = new Pen(line.m_Color, line.m_Thickness);

                    Point lastPoint = new Point();
                    lastPoint.X = m_OffsetX;
                    lastPoint.Y = Height - ((line.m_MagnitudeList[0] *
                       Height) / (m_MaxPeek - m_MinPeek));

                    for (int n = 0; n < line.m_MagnitudeList.Count; ++n)
                    {
                        if (line.m_bShowAsBar)
                        {
                            /* The line is set to be shown as a bar graph, so
                            first we get the bars rectangle, then draw the bar */

                            Rectangle barRect = new Rectangle();

                            // Weird hack because BarRect.Location.* causes error
                            Point p = barRect.Location;
                            p.X = m_OffsetX + (n * m_LineInterval) + 1;
                            p.Y = Height - ((line.m_MagnitudeList[n] * Height) /
                                                (m_MaxPeek - m_MinPeek));
                            barRect.Location = p;

                            barRect.Width = m_LineInterval - 1;
                            barRect.Height = Height;

                            DrawBar(barRect, line, ref g);
                        }
                        else
                        {
                            /* Draw a line */

                            int newX = m_OffsetX + (n * m_LineInterval);
                            int newY = Height - ((line.m_MagnitudeList[n] * Height) /
                                (m_MaxPeek - m_MinPeek));

                            g.DrawLine(linePen, lastPoint.X, lastPoint.Y, newX, newY);

                            lastPoint.X = newX;
                            lastPoint.Y = newY;
                        }
                    }

                    linePen.Dispose();
                }
            }
开发者ID:jeffboulanger,项目名称:runuogdk,代码行数:101,代码来源:2DPushGraph.cs

示例11: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     SolidBrush b = new SolidBrush(this.ForeColor);
     Int32 w = this.ClientSize.Width;
     Int32 h = this.ClientSize.Height;
     Int32 y = h;
     // draw text
     y -= this.Font.Height + 4;
     RectangleF r = new RectangleF(0, y, w, h);
     StringFormat f = new StringFormat(StringFormatFlags.NoWrap);
     f.Alignment = StringAlignment.Center;
     e.Graphics.DrawString(this.Text, this.Font, b, r, f);
     // draw graph
     Int32 graphheight = h - 6 - 4 - this.Font.Height - 4;
     graphheight += 1;
     Int32 lines = graphheight / 3;
     Byte red = (Byte)(this.ForeColor.R / 2);
     Byte green = (Byte)(this.ForeColor.G / 2);
     Byte blue = (Byte)(this.ForeColor.B / 2);
     Color dimmed = Color.FromArgb(red, green, blue);
     Pen dpen = new Pen(dimmed);
     Pen hpen = new Pen(this.ForeColor);
     dpen.DashStyle = DashStyle.Dot;
     Int32 lx = (w - this.GraphWidth) / 2;
     Int32 ly = h - 4 - this.Font.Height - 7;
     Int32 lw = this.GraphWidth / 2;
     Int32 x0 = lx;
     Int32 y0 = 0;
     Int32 x1 = 0;
     Int32 y1 = 0;
     Int32 linestohighlite = (Int32)Math.Ceiling(
         (this.Value - this.Minimum) * 1.0 /
         ((this.Maximum - this.Minimum * 1.0) / lines)
         );
     for (Int32 i = 0; i < lines; i++)
     {
         x0 = lx;
         y0 = ly - (i * 3) - 1;
         x1 = x0 + lw;
         y1 = y0;
         if (i < linestohighlite)
         {
             e.Graphics.FillRectangle(b, x0, y0, lw, 2);
             e.Graphics.FillRectangle(b, x1 + 1, y0, lw, 2);
         }
         else
         {
             // left two lines
             e.Graphics.DrawLine(dpen, x0, y0, x1, y1);
             e.Graphics.DrawLine(dpen, x0 + 1, y0 + 1, x1, y1 + 1);
             // right two lines
             x0 = x1 + 1;
             x1 = x0 + lw;
             e.Graphics.DrawLine(dpen, x0, y0, x1, y1);
             e.Graphics.DrawLine(dpen, x0 + 1, y0 + 1, x1, y1 + 1);
         }
     }
     hpen.Dispose();
     dpen.Dispose();
     b.Dispose();
 }
开发者ID:tsovince,项目名称:V_Library,代码行数:61,代码来源:Inticator.cs

示例12: OnPaintBackground

	protected override void OnPaintBackground(PaintEventArgs e)
	{
		base.OnPaintBackground(e);

		e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

		GraphicsPath graphPath = GetPath();

		//	Create Gradient Brush (Cannot be width or height 0)
		LinearGradientBrush filler;
		Rectangle rect = ClientRectangle;

		if (rect.Width == 0)
		{
			rect.Width = 1;
		}

		if (rect.Height == 0)
		{
			rect.Height = 1;
		}

		// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
		if (_GradientMode == LinearGradientMode.None) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression
		{
			filler = new LinearGradientBrush(rect, _BackColour1, _BackColour1, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
		}
		else
		{
			filler = new LinearGradientBrush(rect, _BackColour1, _BackColour2, (System.Drawing.Drawing2D.LinearGradientMode) _GradientMode);
		}

		e.Graphics.FillPath(filler, graphPath);
		filler.Dispose();

		switch (_BorderStyle)
		{
		case BorderStyle.FixedSingle:
			Pen borderPen = new Pen(_BorderColour, _BorderWidth);
			e.Graphics.DrawPath(borderPen, graphPath);
			borderPen.Dispose();
			break;

		case BorderStyle.Fixed3D:
			DrawBorder3D(e.Graphics, ClientRectangle);
			break;

		case BorderStyle.None:
			break;
		}

		filler.Dispose();
		graphPath.Dispose();
	}
开发者ID:killbug2004,项目名称:WSProf,代码行数:54,代码来源:CustomPanel.cs

示例13: Process


//.........这里部分代码省略.........

                            g.DrawPolygon(whitePen, quadrado0);
                            g.DrawPolygon(whitePen, quadrado1);
                            g.DrawPolygon(whitePen, quadrado2);
                            g.DrawPolygon(whitePen, quadrado3);
                            g.DrawPolygon(whitePen, quadrado4);
                            g.DrawPolygon(whitePen, quadrado5);
                            g.DrawPolygon(whitePen, quadrado6);
                            g.DrawPolygon(whitePen, quadrado7);
                            g.DrawPolygon(whitePen, quadrado8);
                            g.DrawPolygon(whitePen, quadrado9);
                            g.DrawPolygon(whitePen, quadrado10);
                            g.DrawPolygon(whitePen, quadrado11);
                            g.DrawPolygon(whitePen, quadrado12);
                            g.DrawPolygon(whitePen, quadrado13);
                            g.DrawPolygon(whitePen, quadrado14);
                            g.DrawPolygon(whitePen, quadrado15);

                            g.DrawPolygon(whitePen, quadrado17);
                            g.DrawPolygon(whitePen, quadrado18);
                            g.DrawPolygon(whitePen, quadrado19);
                            g.DrawPolygon(whitePen, quadrado20);
                            g.DrawPolygon(whitePen, quadrado21);
                            g.DrawPolygon(whitePen, quadrado22);
                            g.DrawPolygon(whitePen, quadrado23);
                            g.DrawPolygon(whitePen, quadrado24);
                            g.DrawPolygon(whitePen, quadrado25);
                            g.DrawPolygon(whitePen, quadrado26);
                            g.DrawPolygon(whitePen, quadrado27);
                            g.DrawPolygon(whitePen, quadrado28);
                            g.DrawPolygon(whitePen, quadrado29);
                            g.DrawPolygon(whitePen, quadrado30);
                            g.DrawPolygon(whitePen, quadrado31);
                            g.DrawPolygon(whitePen, quadrado32);

                            g.DrawPolygon(whitePen, quadrado34);
                            g.DrawPolygon(whitePen, quadrado35);
                            g.DrawPolygon(whitePen, quadrado36);
                            g.DrawPolygon(whitePen, quadrado37);
                            g.DrawPolygon(whitePen, quadrado38);
                            g.DrawPolygon(whitePen, quadrado39);
                            g.DrawPolygon(whitePen, quadrado40);
                            g.DrawPolygon(whitePen, quadrado41);
                            g.DrawPolygon(whitePen, quadrado42);
                            g.DrawPolygon(whitePen, quadrado43);
                            g.DrawPolygon(whitePen, quadrado44);
                            g.DrawPolygon(whitePen, quadrado45);
                            g.DrawPolygon(whitePen, quadrado46);
                            g.DrawPolygon(whitePen, quadrado47);
                            g.DrawPolygon(whitePen, quadrado48);
                            g.DrawPolygon(whitePen, quadrado49);

                            g.DrawPolygon(whitePen, quadrado51);
                            g.DrawPolygon(whitePen, quadrado52);
                            g.DrawPolygon(whitePen, quadrado53);
                            g.DrawPolygon(whitePen, quadrado54);
                            g.DrawPolygon(whitePen, quadrado55);
                            g.DrawPolygon(whitePen, quadrado56);
                            g.DrawPolygon(whitePen, quadrado57);
                            g.DrawPolygon(whitePen, quadrado58);
                            g.DrawPolygon(whitePen, quadrado59);
                            g.DrawPolygon(whitePen, quadrado60);
                            g.DrawPolygon(whitePen, quadrado61);
                            g.DrawPolygon(whitePen, quadrado62);
                            g.DrawPolygon(whitePen, quadrado63);
                            g.DrawPolygon(whitePen, quadrado64);
                            g.DrawPolygon(whitePen, quadrado65);
                            g.DrawPolygon(whitePen, quadrado66);

                            g.DrawPolygon(whitePen, quadrado68);
                            g.DrawPolygon(whitePen, quadrado69);
                            g.DrawPolygon(whitePen, quadrado70);
                            g.DrawPolygon(whitePen, quadrado71);
                            g.DrawPolygon(whitePen, quadrado72);
                            g.DrawPolygon(whitePen, quadrado73);
                            g.DrawPolygon(whitePen, quadrado74);
                            g.DrawPolygon(whitePen, quadrado75);
                            g.DrawPolygon(whitePen, quadrado76);
                            g.DrawPolygon(whitePen, quadrado77);
                            g.DrawPolygon(whitePen, quadrado78);
                            g.DrawPolygon(whitePen, quadrado79);
                            g.DrawPolygon(whitePen, quadrado80);
                            g.DrawPolygon(whitePen, quadrado81);
                            g.DrawPolygon(whitePen, quadrado82);
                            g.DrawPolygon(whitePen, quadrado83);
                            g.DrawLine(penIn, p10, p11);
                            g.DrawLine(penIn, p12, p13);
                     }
                     catch { }
                        }
                    }
                }
            }
        }
        greenPen.Dispose();
        penIn.Dispose();
        whitePen.Dispose();
        NewTargetPosition(Center, image);
        g.Dispose();
    }
开发者ID:jeffersonpp,项目名称:REPO,代码行数:101,代码来源:ImageProcessor.cs


注:本文中的Pen.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。