GraphicsPathIterator.HasCurve 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이와 연결된 경로에 곡선이 GraphicsPathIterator 포함되어 있는지 여부를 나타냅니다.
public:
bool HasCurve();
public bool HasCurve();
member this.HasCurve : unit -> bool
Public Function HasCurve () As Boolean
반품
이 메서드는 현재 하위 경로에 곡선이 포함되어 있으면 반환하고, true그렇지 않으면 반환 false 합니다.
예제
다음 예제는 Windows Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 개체인 eOnPaint 필요합니다. 코드는 다음 작업을 수행합니다.
개체GraphicsPath를
myPath만듭니다.세 줄, 사각형 및 줄임표를 추가합니다.
에 대한 개체를 GraphicsPathIterator
myPath만듭니다.현재 경로
myPath에 곡선이 포함되어 있는지 테스트합니다.메시지 상자에 테스트 결과를 표시합니다.
private:
void HasCurveExample( PaintEventArgs^ /*e*/ )
{
// Create a path and add three lines,
// a rectangle and an ellipse.
GraphicsPath^ myPath = gcnew GraphicsPath;
array<Point>^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)};
Rectangle myRect = Rectangle(120,120,100,100);
myPath->AddLines( myPoints );
myPath->AddRectangle( myRect );
myPath->AddEllipse( 220, 220, 100, 100 );
// Create a GraphicsPathIterator for myPath.
GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath );
// Test for a curve.
bool myHasCurve = myPathIterator->HasCurve();
// Show the test result.
MessageBox::Show( myHasCurve.ToString() );
}
private void HasCurveExample(PaintEventArgs e)
{
// Create a path and add three lines,
// a rectangle and an ellipse.
GraphicsPath myPath = new GraphicsPath();
Point[] myPoints = {new Point(20, 20), new Point(120, 120),
new Point(20, 120),new Point(20, 20) };
Rectangle myRect = new Rectangle(120, 120, 100, 100);
myPath.AddLines(myPoints);
myPath.AddRectangle(myRect);
myPath.AddEllipse(220, 220, 100, 100);
// Create a GraphicsPathIterator for myPath.
GraphicsPathIterator myPathIterator = new
GraphicsPathIterator(myPath);
// Test for a curve.
bool myHasCurve = myPathIterator.HasCurve();
// Show the test result.
MessageBox.Show(myHasCurve.ToString());
}
Public Sub HasCurveExample(ByVal e As PaintEventArgs)
Dim myPath As New GraphicsPath
Dim myPoints As Point() = {New Point(20, 20), _
New Point(120, 120), New Point(20, 120), New Point(20, 20)}
Dim myRect As New Rectangle(120, 120, 100, 100)
myPath.AddLines(myPoints)
myPath.AddRectangle(myRect)
myPath.AddEllipse(220, 220, 100, 100)
' Create a GraphicsPathIterator for myPath.
Dim myPathIterator As New GraphicsPathIterator(myPath)
Dim myHasCurve As Boolean = myPathIterator.HasCurve()
MessageBox.Show(myHasCurve.ToString())
End Sub
설명
경로의 모든 곡선은 Bézier 스플라인 시퀀스로 저장됩니다. 예를 들어 경로에 줄임표를 추가할 때 왼쪽 위 모서리, 너비 및 줄임표 경계 사각형의 높이를 지정합니다. 이러한 숫자(왼쪽 위 모서리, 너비 및 높이)는 경로에 저장되지 않습니다. 대신; 타원은 네 개의 베지어 스플라인 시퀀스로 변환됩니다. 경로는 해당 Bézier 스플라인의 엔드포인트 및 제어점을 저장합니다.
경로는 각 데이터 요소의 배열을 저장하며, 각 데이터 요소는 선 또는 Bézier 스플라인에 속합니다. 배열의 일부 점이 Bézier 스플라인에 속하는 경우 반환합니다 HasCurvetrue. 배열의 모든 점이 줄 HasCurve 에 속하는 경우 .false
특정 메서드는 경로를 평면화합니다. 즉, 경로의 모든 곡선이 선 시퀀스로 변환됩니다. 경로가 평면화되면 HasCurve 항상 반환 false됩니다. 클래스의 Flatten메서드 또는 Widen 메서드Warp를 GraphicsPath 호출하면 경로가 평면화됩니다.