Graphics.DrawCurve 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
透過指定的結構陣列 Point 繪製基數樣條。
多載
DrawCurve(Pen, ReadOnlySpan<PointF>, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, float tension);
public void DrawCurve(System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF), tension As Single)
參數
- points
- ReadOnlySpan<PointF>
定義樣條的結構陣列 Point 。
- tension
- Single
值大於或等於0.0F,表示曲線張力。
適用於
DrawCurve(Pen, ReadOnlySpan<PointF>, Int32, Int32, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, int offset, int numberOfSegments, float tension);
public void DrawCurve(System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * int * int * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF), offset As Integer, numberOfSegments As Integer, tension As Single)
參數
- points
- ReadOnlySpan<PointF>
定義樣條的結構陣列 Point 。
- offset
- Int32
從參數陣列 points 中的第一個元素偏移到曲線的起點。
- numberOfSegments
- Int32
起點後的段數,包含在曲線中。
- tension
- Single
值大於或等於0.0F,表示曲線張力。
適用於
DrawCurve(Pen, ReadOnlySpan<Point>, Int32, Int32, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points, int offset, int numberOfSegments, float tension);
public void DrawCurve(System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> * int * int * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of Point), offset As Integer, numberOfSegments As Integer, tension As Single)
參數
- points
- ReadOnlySpan<Point>
定義樣條的結構陣列 Point 。
- offset
- Int32
從參數陣列 points 中的第一個元素偏移到曲線的起點。
- numberOfSegments
- Int32
起點後的段數,包含在曲線中。
- tension
- Single
值大於或等於0.0F,表示曲線張力。
適用於
DrawCurve(Pen, PointF[], Int32, Int32, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 PointF 中繪製基數樣條。 繪圖從陣列起始點偏移開始。
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, int offset, int numberOfSegments, float tension);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] * int * int * single -> unit
Public Sub DrawCurve (pen As Pen, points As PointF(), offset As Integer, numberOfSegments As Integer, tension As Single)
參數
- offset
- Int32
從參數陣列 points 中的第一個元素偏移到曲線的起點。
- numberOfSegments
- Int32
起點後的段數,包含在曲線中。
- tension
- Single
值大於或等於0.0F,表示曲線張力。
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
創造七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
定義起點偏移量及分段數。
定義了緊張感。
從第三點開始畫一條開放的綠色曲線,延伸至最後五點。
此方法將張力設為1.0。
private:
void DrawCurvePointFSegmentTension( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
PointF point1 = PointF(50.0F,50.0F);
PointF point2 = PointF(100.0F,25.0F);
PointF point3 = PointF(200.0F,5.0F);
PointF point4 = PointF(250.0F,50.0F);
PointF point5 = PointF(300.0F,100.0F);
PointF point6 = PointF(350.0F,200.0F);
PointF point7 = PointF(250.0F,250.0F);
array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create offset, number of segments, and tension.
int offset = 2;
int numSegments = 4;
float tension = 1.0F;
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension );
}
private void DrawCurvePointFSegmentTension(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
PointF point1 = new PointF(50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create offset, number of segments, and tension.
int offset = 2;
int numSegments = 4;
float tension = 1.0F;
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
}
Private Sub DrawCurvePointFSegmentTension(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New PointF(50.0F, 50.0F)
Dim point2 As New PointF(100.0F, 25.0F)
Dim point3 As New PointF(200.0F, 5.0F)
Dim point4 As New PointF(250.0F, 50.0F)
Dim point5 As New PointF(300.0F, 100.0F)
Dim point6 As New PointF(350.0F, 200.0F)
Dim point7 As New PointF(250.0F, 250.0F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create offset, number of segments, and tension.
Dim offset As Integer = 2
Dim numSegments As Integer = 4
Dim tension As Single = 1.0F
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, _
tension)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 PointF 結構,才能繪製曲線。
參數的 offset 值指定陣列中要跳過的元素數量。 跳過元素之後的第一個元素代表曲線的起點。
參數的 numberOfSegments 值指定了起點之後要在曲線中繪製的線段數量。 參數值 numberOfSegments 必須至少為 1。 參數值 offset 加 numberOfSegments 參數值必須小於該參數陣列 points 中元素的數量。
參數 tension 決定了樣條的形狀。 若參數值 tension 為 0.0F,此方法會繪製直線段連接點。 通常,該 tension 參數小於或等於1.0F。 超過1.0華氏度的數值會產生異常結果。
適用於
DrawCurve(Pen, Point[], Int32, Int32, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points, int offset, int numberOfSegments, float tension);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.Point[] points, int offset, int numberOfSegments, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.Point[] * int * int * single -> unit
Public Sub DrawCurve (pen As Pen, points As Point(), offset As Integer, numberOfSegments As Integer, tension As Single)
參數
- offset
- Int32
從參數陣列 points 中的第一個元素偏移到曲線的起點。
- numberOfSegments
- Int32
起點後的段數,包含在曲線中。
- tension
- Single
值大於或等於0.0F,表示曲線張力。
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
創造七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
定義起點偏移量及分段數。
定義了緊張感。
從第三點開始畫一條開放的綠色曲線,延伸至最後五點。
此方法將張力設為1.0。
private:
void DrawCurvePointSegmentTension( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
Point point1 = Point(50,50);
Point point2 = Point(100,25);
Point point3 = Point(200,5);
Point point4 = Point(250,50);
Point point5 = Point(300,100);
Point point6 = Point(350,200);
Point point7 = Point(250,250);
array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create offset, number of segments, and tension.
int offset = 2;
int numSegments = 4;
float tension = 1.0F;
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension );
}
private void DrawCurvePointSegmentTension(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
Point point1 = new Point(50, 50);
Point point2 = new Point(100, 25);
Point point3 = new Point(200, 5);
Point point4 = new Point(250, 50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);
Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create offset, number of segments, and tension.
int offset = 2;
int numSegments = 4;
float tension = 1.0F;
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, tension);
}
Private Sub DrawCurvePointSegmentTension(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create offset, number of segments, and tension.
Dim offset As Integer = 2
Dim numSegments As Integer = 4
Dim tension As Single = 1.0F
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments, _
tension)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 Point 結構,才能繪製曲線。
參數的 offset 值指定陣列中要跳過的元素數量。 跳過元素之後的第一個元素代表曲線的起點。
參數的 numberOfSegments 值指定了起點之後要在曲線中繪製的線段數量。 參數值 numberOfSegments 必須至少為 1。 參數值 offset 加 numberOfSegments 參數值必須小於該參數陣列 points 中元素的數量。
參數 tension 決定了樣條的形狀。 若參數值 tension 為 0.0F,此方法會繪製直線段連接點。 通常,該 tension 參數小於或等於1.0F。 超過1.0華氏度的數值會產生異常結果。
適用於
DrawCurve(Pen, ReadOnlySpan<PointF>, Int32, Int32)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points, int offset, int numberOfSegments);
public void DrawCurve(System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.PointF> points, int offset, int numberOfSegments);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> * int * int -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF), offset As Integer, numberOfSegments As Integer)
參數
- points
- ReadOnlySpan<PointF>
定義樣條的結構陣列 Point 。
- offset
- Int32
從參數陣列 points 中的第一個元素偏移到曲線的起點。
- numberOfSegments
- Int32
起點後的段數,包含在曲線中。
適用於
DrawCurve(Pen, PointF[], Int32, Int32)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
透過指定的結構陣列 PointF 繪製基數樣條。 繪圖從陣列起始點偏移開始。
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, int offset, int numberOfSegments);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, int offset, int numberOfSegments);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] * int * int -> unit
Public Sub DrawCurve (pen As Pen, points As PointF(), offset As Integer, numberOfSegments As Integer)
參數
- offset
- Int32
從參數陣列 points 中的第一個元素偏移到曲線的起點。
- numberOfSegments
- Int32
起點後的段數,包含在曲線中。
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
創造七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
定義起點偏移量及分段數。
從第三點開始畫一條開放的綠色曲線,延伸至最後五點。
此方法使用預設張力為0.5。
private:
void DrawCurvePointFSegments( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
PointF point1 = PointF(50.0F,50.0F);
PointF point2 = PointF(100.0F,25.0F);
PointF point3 = PointF(200.0F,5.0F);
PointF point4 = PointF(250.0F,50.0F);
PointF point5 = PointF(300.0F,100.0F);
PointF point6 = PointF(350.0F,200.0F);
PointF point7 = PointF(250.0F,250.0F);
array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create offset and number of segments.
int offset = 2;
int numSegments = 4;
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments );
}
private void DrawCurvePointFSegments(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
PointF point1 = new PointF(50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create offset and number of segments.
int offset = 2;
int numSegments = 4;
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments);
}
Private Sub DrawCurvePointFSegments(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New PointF(50.0F, 50.0F)
Dim point2 As New PointF(100.0F, 25.0F)
Dim point3 As New PointF(200.0F, 5.0F)
Dim point4 As New PointF(250.0F, 50.0F)
Dim point5 As New PointF(300.0F, 100.0F)
Dim point6 As New PointF(350.0F, 200.0F)
Dim point7 As New PointF(250.0F, 250.0F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create offset and number of segments.
Dim offset As Integer = 2
Dim numSegments As Integer = 4
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, offset, numSegments)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 PointF 結構,才能繪製曲線。
參數的 offset 值指定陣列中要跳過的元素數量。 跳過元素之後的第一個元素代表曲線的起點。
參數的 numberOfSegments 值指定了起點之後要在曲線中繪製的線段數量。 參數值 numberOfSegments 必須至少為 1。 參數值 offset 加 numberOfSegments 參數值必須小於該參數陣列 points 中元素的數量。
此方法使用預設張力為0.5。
適用於
DrawCurve(Pen, PointF[], Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 PointF 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points, float tension);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] * single -> unit
Public Sub DrawCurve (pen As Pen, points As PointF(), tension As Single)
參數
- tension
- Single
值大於或等於0.0F,表示曲線張力。
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
產生七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
這樣可以營造張力。
在七個點上畫出一條開放綠色封閉曲線。
此方法使用張力為1.0。
private:
void DrawCurvePointFTension( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
PointF point1 = PointF(50.0F,50.0F);
PointF point2 = PointF(100.0F,25.0F);
PointF point3 = PointF(200.0F,5.0F);
PointF point4 = PointF(250.0F,50.0F);
PointF point5 = PointF(300.0F,100.0F);
PointF point6 = PointF(350.0F,200.0F);
PointF point7 = PointF(250.0F,250.0F);
array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create tension.
float tension = 1.0F;
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints, tension );
}
private void DrawCurvePointFTension(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
PointF point1 = new PointF(50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create tension.
float tension = 1.0F;
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, tension);
}
Private Sub DrawCurvePointFTension(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New PointF(50.0F, 50.0F)
Dim point2 As New PointF(100.0F, 25.0F)
Dim point3 As New PointF(200.0F, 5.0F)
Dim point4 As New PointF(250.0F, 50.0F)
Dim point5 As New PointF(300.0F, 100.0F)
Dim point6 As New PointF(350.0F, 200.0F)
Dim point7 As New PointF(250.0F, 250.0F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create tension.
Dim tension As Single = 1.0F
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, tension)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 PointF 結構,才能繪製曲線。
參數 tension 決定了樣條的形狀。 若參數值 tension 為 0.0F,此方法會繪製直線段連接點。 通常,該 tension 參數小於或等於1.0F。 超過1.0華氏度的數值會產生異常結果。
適用於
DrawCurve(Pen, Point[], Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points, float tension);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.Point[] points, float tension);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.Point[] * single -> unit
Public Sub DrawCurve (pen As Pen, points As Point(), tension As Single)
參數
- tension
- Single
值大於或等於0.0F,表示曲線張力。
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
產生七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
這樣可以營造張力。
在七個點上畫出一條開放綠色封閉曲線。
此方法使用張力為1.0。
private:
void DrawCurvePointTension( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
Point point1 = Point(50,50);
Point point2 = Point(100,25);
Point point3 = Point(200,5);
Point point4 = Point(250,50);
Point point5 = Point(300,100);
Point point6 = Point(350,200);
Point point7 = Point(250,250);
array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Create tension.
float tension = 1.0F;
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints, tension );
}
private void DrawCurvePointTension(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
Point point1 = new Point(50, 50);
Point point2 = new Point(100, 25);
Point point3 = new Point(200, 5);
Point point4 = new Point(250, 50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);
Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Create tension.
float tension = 1.0F;
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, tension);
}
Private Sub DrawCurvePointTension(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Create tension.
Dim tension As Single = 1.0F
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints, tension)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 Point 結構,才能繪製曲線。
參數 tension 決定了樣條的形狀。 若參數值 tension 為 0.0F,此方法會繪製直線段連接點。 通常,該 tension 參數小於或等於1.0F。 超過1.0華氏度的數值會產生異常結果。
適用於
DrawCurve(Pen, ReadOnlySpan<PointF>)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points);
public void DrawCurve(System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of PointF))
參數
- points
- ReadOnlySpan<PointF>
定義樣條的結構陣列 Point 。
適用於
DrawCurve(Pen, ReadOnlySpan<Point>)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points);
public void DrawCurve(System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.Point> points);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of Point))
參數
- points
- ReadOnlySpan<Point>
定義樣條的結構陣列 Point 。
適用於
DrawCurve(Pen, PointF[])
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
透過指定的結構陣列 PointF 繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::PointF> ^ points);
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points);
public void DrawCurve(System.Drawing.Pen pen, params System.Drawing.PointF[] points);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.PointF[] points);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.PointF[] -> unit
Public Sub DrawCurve (pen As Pen, ParamArray points As PointF())
Public Sub DrawCurve (pen As Pen, points As PointF())
參數
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
創造七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
在七個點上畫出一條開放的綠色曲線。
此方法使用預設張力為0.5。
private:
void DrawCurvePointF( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
PointF point1 = PointF(50.0F,50.0F);
PointF point2 = PointF(100.0F,25.0F);
PointF point3 = PointF(200.0F,5.0F);
PointF point4 = PointF(250.0F,50.0F);
PointF point5 = PointF(300.0F,100.0F);
PointF point6 = PointF(350.0F,200.0F);
PointF point7 = PointF(250.0F,250.0F);
array<PointF>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints );
}
private void DrawCurvePointF(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
PointF point1 = new PointF(50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints);
}
Private Sub DrawCurvePointF(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New PointF(50.0F, 50.0F)
Dim point2 As New PointF(100.0F, 25.0F)
Dim point3 As New PointF(200.0F, 5.0F)
Dim point4 As New PointF(250.0F, 50.0F)
Dim point5 As New PointF(300.0F, 100.0F)
Dim point6 As New PointF(350.0F, 200.0F)
Dim point7 As New PointF(250.0F, 250.0F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 PointF 結構,才能繪製曲線。
此方法使用預設張力為0.5。
適用於
DrawCurve(Pen, Point[])
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
透過指定的結構陣列 Point 繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::Point> ^ points);
public:
void DrawCurve(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points);
public void DrawCurve(System.Drawing.Pen pen, params System.Drawing.Point[] points);
public void DrawCurve(System.Drawing.Pen pen, System.Drawing.Point[] points);
member this.DrawCurve : System.Drawing.Pen * System.Drawing.Point[] -> unit
Public Sub DrawCurve (pen As Pen, ParamArray points As Point())
Public Sub DrawCurve (pen As Pen, points As Point())
參數
例外狀況
範例
以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:
會產生紅色和綠色的筆。
創造七個點來定義曲線。
在七個點之間畫出六條紅色直線,形成一個不完整的多邊形。
在七個點上畫出一條開放的綠色曲線。
此方法使用預設張力為0.5。
private:
void DrawCurvePoint( PaintEventArgs^ e )
{
// Create pens.
Pen^ redPen = gcnew Pen( Color::Red,3.0f );
Pen^ greenPen = gcnew Pen( Color::Green,3.0f );
// Create points that define curve.
Point point1 = Point(50,50);
Point point2 = Point(100,25);
Point point3 = Point(200,5);
Point point4 = Point(250,50);
Point point5 = Point(300,100);
Point point6 = Point(350,200);
Point point7 = Point(250,250);
array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
// Draw lines between original points to screen.
e->Graphics->DrawLines( redPen, curvePoints );
// Draw curve to screen.
e->Graphics->DrawCurve( greenPen, curvePoints );
}
private void DrawCurvePoint(PaintEventArgs e)
{
// Create pens.
Pen redPen = new Pen(Color.Red, 3);
Pen greenPen = new Pen(Color.Green, 3);
// Create points that define curve.
Point point1 = new Point(50, 50);
Point point2 = new Point(100, 25);
Point point3 = new Point(200, 5);
Point point4 = new Point(250, 50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);
Point[] curvePoints = {point1, point2, point3, point4, point5, point6, point7};
// Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints);
// Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints);
}
Private Sub DrawCurvePoint(ByVal e As PaintEventArgs)
' Create pens.
Dim redPen As New Pen(Color.Red, 3)
Dim greenPen As New Pen(Color.Green, 3)
' Create points that define curve.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() = {point1, point2, point3, point4, _
point5, point6, point7}
' Draw lines between original points to screen.
e.Graphics.DrawLines(redPen, curvePoints)
' Draw curve to screen.
e.Graphics.DrawCurve(greenPen, curvePoints)
End Sub
備註
此方法繪製一個基數樣條,通過陣列中的每個點。
點陣列必須包含至少三個 Point 結構,才能繪製曲線。
此方法使用預設張力為0.5。
適用於
DrawCurve(Pen, ReadOnlySpan<Point>, Single)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
以指定的張力在指定結構陣列 Point 中繪製基數樣條。
public:
void DrawCurve(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points, float tension);
public void DrawCurve(System.Drawing.Pen pen, ReadOnlySpan<System.Drawing.Point> points, float tension);
member this.DrawCurve : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> * single -> unit
Public Sub DrawCurve (pen As Pen, points As ReadOnlySpan(Of Point), tension As Single)
參數
- points
- ReadOnlySpan<Point>
定義樣條的結構陣列 Point 。
- tension
- Single
值大於或等於0.0F,表示曲線張力。