本文整理汇总了C#中System.Drawing.Pen.StartCap属性的典型用法代码示例。如果您正苦于以下问题:C# Pen.StartCap属性的具体用法?C# Pen.StartCap怎么用?C# Pen.StartCap使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Drawing.Pen
的用法示例。
在下文中一共展示了Pen.StartCap属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowStartAndEndCaps
private void ShowStartAndEndCaps(PaintEventArgs e)
{
// Create a new custom pen.
Pen redPen = new Pen(Brushes.Red, 6.0F);
// Set the StartCap property.
redPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;
// Set the EndCap property.
redPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
// Draw a line.
e.Graphics.DrawLine(redPen, 40.0F, 40.0F, 145.0F, 185.0F);
// Dispose of the custom pen.
redPen.Dispose();
}
示例2: Main
//引入命名空间
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
public class Form1 : System.Windows.Forms.Form {
[STAThread]
static void Main() {
Application.Run(new Form1());
}
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
Pen p = new Pen(Color.Brown, 15);
p.StartCap = LineCap.SquareAnchor;
p.EndCap = LineCap.SquareAnchor;
g.DrawLine(p, 30, 190, Width - 50, 190);
}
}