GraphicsPath.ClearMarkers Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Удаляет все токены из этого контура.
public:
void ClearMarkers();
public void ClearMarkers ();
member this.ClearMarkers : unit -> unit
Public Sub ClearMarkers ()
Примеры
В следующем примере кода используется Windows Forms и требуется PaintEventArgs e
OnPaint объект события. Код выполняет следующие действия.
Создает путь.
Добавляет несколько объектов в путь.
Добавляет маркеры в путь.
Очищает все маркеры из пути.
Рисует путь к экрану.
private:
void ClearMarkersExample( PaintEventArgs^ e )
{
// Set several markers in a path.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddEllipse( 0, 0, 100, 200 );
myPath->SetMarkers();
myPath->AddLine( Point(100,100), Point(200,100) );
Rectangle rect = Rectangle(200,0,100,200);
myPath->AddRectangle( rect );
myPath->SetMarkers();
myPath->AddLine( Point(250,200), Point(250,300) );
myPath->SetMarkers();
// Clear the markers.
myPath->ClearMarkers();
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void ClearMarkersExample(PaintEventArgs e)
{
// Set several markers in a path.
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(0, 0, 100, 200);
myPath.SetMarkers();
myPath.AddLine(new Point(100, 100), new Point(200, 100));
Rectangle rect = new Rectangle(200, 0, 100, 200);
myPath.AddRectangle(rect);
myPath.SetMarkers();
myPath.AddLine(new Point(250, 200), new Point(250, 300));
myPath.SetMarkers();
// Clear the markers.
myPath.ClearMarkers();
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub ClearMarkersExample(ByVal e As PaintEventArgs)
' Set several markers in a path.
Dim myPath As New GraphicsPath
myPath.AddEllipse(0, 0, 100, 200)
myPath.SetMarkers()
myPath.AddLine(New Point(100, 100), New Point(200, 100))
Dim rect As New Rectangle(200, 0, 100, 200)
myPath.AddRectangle(rect)
myPath.SetMarkers()
myPath.AddLine(New Point(250, 200), New Point(250, 300))
myPath.SetMarkers()
' Clear the markers.
myPath.ClearMarkers()
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
Комментарии
SetMarkers Используйте метод для создания маркера в текущем расположении в .GraphicsPath NextMarker Используйте метод, чтобы выполнить итерацию по существующим маркерам в пути.
Маркеры используются для разделения групп подпаток. Один или несколько подпатов могут содержаться между двумя маркерами.