Pen.SetLineCap(LineCap, LineCap, DashCap) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设置用于由此 Pen绘制的结束线条的上限样式的值。
public:
void SetLineCap(System::Drawing::Drawing2D::LineCap startCap, System::Drawing::Drawing2D::LineCap endCap, System::Drawing::Drawing2D::DashCap dashCap);
public void SetLineCap (System.Drawing.Drawing2D.LineCap startCap, System.Drawing.Drawing2D.LineCap endCap, System.Drawing.Drawing2D.DashCap dashCap);
member this.SetLineCap : System.Drawing.Drawing2D.LineCap * System.Drawing.Drawing2D.LineCap * System.Drawing.Drawing2D.DashCap -> unit
Public Sub SetLineCap (startCap As LineCap, endCap As LineCap, dashCap As DashCap)
参数
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码创建一个 Pen 并将其设置为在线条开头绘制箭头定位点盖:
public:
void SetLineCap_Example( PaintEventArgs^ e )
{
// Create a Pen object with a dash pattern.
Pen^ capPen = gcnew Pen( Color::Black,5.0f );
capPen->DashStyle = DashStyle::Dash;
// Set the start and end caps for capPen.
capPen->SetLineCap( LineCap::ArrowAnchor, LineCap::Flat, DashCap::Flat );
// Draw a line with capPen.
e->Graphics->DrawLine( capPen, 10, 10, 200, 10 );
}
public void SetLineCap_Example(PaintEventArgs e)
{
// Create a Pen object with a dash pattern.
Pen capPen = new Pen(Color.Black, 5);
capPen.DashStyle = DashStyle.Dash;
// Set the start and end caps for capPen.
capPen.SetLineCap(LineCap.ArrowAnchor, LineCap.Flat, DashCap.Flat);
// Draw a line with capPen.
e.Graphics.DrawLine(capPen, 10, 10, 200, 10);
}
Public Sub SetLineCap_Example(ByVal e As PaintEventArgs)
' Create a Pen object with a dash pattern.
Dim capPen As New Pen(Color.Black, 5)
capPen.DashStyle = DashStyle.Dash
' Set the start and end caps for capPen.
capPen.SetLineCap(LineCap.ArrowAnchor, LineCap.Flat, DashCap.Flat)
' Draw a line with capPen.
e.Graphics.DrawLine(capPen, 10, 10, 200, 10)
End Sub