GraphicsPath.SetMarkers 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在此 GraphicsPath 上设置标记。
public:
void SetMarkers();
public void SetMarkers ();
member this.SetMarkers : unit -> unit
Public Sub SetMarkers ()
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
事件OnPaint对象。 该代码创建一个路径,并将多个基元添加到由标记分隔的路径,并将该路径绘制到屏幕。
private:
void SetMarkersExample( PaintEventArgs^ e )
{
// Create a path and set two markers.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddLine( Point(0,0), Point(50,50) );
myPath->SetMarkers();
Rectangle rect = Rectangle(50,50,50,50);
myPath->AddRectangle( rect );
myPath->SetMarkers();
myPath->AddEllipse( 100, 100, 100, 50 );
// Draw the path to screen.
e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath );
}
private void SetMarkersExample(PaintEventArgs e)
{
// Create a path and set two markers.
GraphicsPath myPath = new GraphicsPath();
myPath.AddLine(new Point(0, 0), new Point(50, 50));
myPath.SetMarkers();
Rectangle rect = new Rectangle(50, 50, 50, 50);
myPath.AddRectangle(rect);
myPath.SetMarkers();
myPath.AddEllipse(100, 100, 100, 50);
// Draw the path to screen.
e.Graphics.DrawPath(new Pen(Color.Black, 2), myPath);
}
Public Sub SetMarkersExample(ByVal e As PaintEventArgs)
' Create a path and set two markers.
Dim myPath As New GraphicsPath
myPath.AddLine(New Point(0, 0), New Point(50, 50))
myPath.SetMarkers()
Dim rect As New Rectangle(50, 50, 50, 50)
myPath.AddRectangle(rect)
myPath.SetMarkers()
myPath.AddEllipse(100, 100, 100, 50)
' Draw the path to screen.
e.Graphics.DrawPath(New Pen(Color.Black, 2), myPath)
End Sub
注解
此方法在路径上创建一个标记,该标记可用于分隔路径的各个部分。 然后, NextMarker 可以使用 方法循环访问路径中的标记。
标记用于分隔子路径组。 路径中的两个标记之间可以包含一个或多个子路径。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈