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 Forms 使用而設計,而且需要 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