GraphicsPathIterator.HasCurve Yöntem

Tanım

Bununla GraphicsPathIterator ilişkilendirilmiş yolun eğri içerip içermediğini gösterir.

public:
 bool HasCurve();
public bool HasCurve ();
member this.HasCurve : unit -> bool
Public Function HasCurve () As Boolean

Döndürülenler

Bu yöntem, geçerli alt yol bir eğri içeriyorsa döndürür true ; aksi takdirde , false.

Örnekler

Aşağıdaki örnek, Windows Forms ile kullanılmak üzere tasarlanmıştır ve bir OnPaint olay nesnesi gerektirir.PaintEventArgse Kod aşağıdaki eylemleri gerçekleştirir:

  • nesnesi GraphicsPathmyPatholuşturur.

  • Üç çizgi, bir dikdörtgen ve üç nokta ekler.

  • için myPathbir GraphicsPathIterator nesnesi oluşturur.

  • Geçerli yolun myPath eğri içerip içermediğini sınar.

  • Testin sonucunu ileti kutusunda gösterir.

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

Açıklamalar

Bir yoldaki tüm eğriler Bézier eğrilerinin dizileri olarak depolanır. Örneğin, bir yola üç nokta eklediğinizde, sol üst köşeyi, üç noktanın sınırlayıcı dikdörtgeninin genişliğini ve yüksekliğini belirtirsiniz. Bu sayılar (sol üst köşe, genişlik ve yükseklik) yolda depolanmaz; Yer -ine; üç nokta dört Bézier splines dizisine dönüştürülür. Yol, bu Bézier spline'larının uç noktalarını ve denetim noktalarını depolar.

Yol, her biri bir satıra veya Bézier spline'a ait olan bir dizi veri noktasını depolar. Dizideki bazı noktalar Bézier splines'a aitse döndürür HasCurvetrue. Dizideki tüm noktalar satırlara aitse, HasCurve döndürür false.

Bazı yöntemler bir yolu düzleştirmesi, yoldaki tüm eğrilerin çizgi dizilerine dönüştürüldüğü anlamına gelir. Bir yol düzlendikten sonra her HasCurve zaman döndürür false. Flattensınıfının , Widenveya Warp yöntemini çağırmak GraphicsPath bir yolu düzleştirmeye neden olur.

Şunlara uygulanır