InkCanvas.Strokes 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public:
property System::Windows::Ink::StrokeCollection ^ Strokes { System::Windows::Ink::StrokeCollection ^ get(); void set(System::Windows::Ink::StrokeCollection ^ value); };
public System.Windows.Ink.StrokeCollection Strokes { get; set; }
member this.Strokes : System.Windows.Ink.StrokeCollection with get, set
Public Property Strokes As StrokeCollection
屬性值
範例
下列範例示範如何將兩 StrokeCollection 個 物件用於相同的 InkCanvas 。 在此範例中,即使玩家共用相同的 InkCanvas ,玩家一和玩家兩個都會使用個別的「手寫筆跡表面」。 此範例假設 Click 事件已連線到事件處理常式 switchPlayersButton_Click
。
StrokeCollection player1;
StrokeCollection player2;
void InitializePlayersCanvases()
{
player1 = inkCanvas1.Strokes;
player2 = new StrokeCollection();
}
// Use a different "inking surface" for each player.
void switchPlayersButton_Click(object sender, RoutedEventArgs e)
{
if (StrokeCollection.ReferenceEquals(inkCanvas1.Strokes, player1))
{
inkCanvas1.Strokes = player2;
}
else
{
inkCanvas1.Strokes = player1;
}
}
void inkCanvas1_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
{
if (StrokeCollection.ReferenceEquals(e.NewStrokes, player1))
{
Title = "Player one's turn";
}
else
{
Title = "Player two's turn";
}
}
Private player1 As StrokeCollection
Private player2 As StrokeCollection
Sub InitializePlayersCanvases()
player1 = inkCanvas1.Strokes
player2 = New StrokeCollection()
End Sub
' Use a different "inking surface" for each player.
Private Sub switchPlayersButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
If StrokeCollection.ReferenceEquals(inkCanvas1.Strokes, player1) Then
inkCanvas1.Strokes = player2
Else
inkCanvas1.Strokes = player1
End If
End Sub
Private Sub inkCanvas1_StrokesReplaced(ByVal sender As Object, _
ByVal e As InkCanvasStrokesReplacedEventArgs)
If StrokeCollection.ReferenceEquals(e.NewStrokes, player1) Then
Title = "Player one's turn"
Else
Title = "Player two's turn"
End If
End Sub
下列範例示範如何將 的 InkCanvas 屬性系結 Strokes 至另一個 InkCanvas 。
<InkCanvas Background="LightGray"
Canvas.Top="0" Canvas.Left="0"
Height="400" Width="200" Name="ic"/>
<!-- Bind the Strokes of the second InkCavas to the first InkCanvas
and mirror the strokes along the Y axis.-->
<InkCanvas Background="LightBlue"
Canvas.Top="0" Canvas.Left="200"
Height="400" Width="200"
Strokes="{Binding ElementName=ic, Path=Strokes}">
<InkCanvas.LayoutTransform>
<ScaleTransform ScaleX="-1" ScaleY="1" />
</InkCanvas.LayoutTransform>
</InkCanvas>
備註
相依性屬性資訊
識別碼欄位 | StrokesProperty |
中繼資料屬性設定為 true |
無 |