StrokeCollection.Replace Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Replaces the strokes in the collection.
Replace(Stroke, StrokeCollection) |
Replaces the specified Stroke with the specified StrokeCollection. |
Replace(StrokeCollection, StrokeCollection) |
Replaces the specified StrokeCollection with a new StrokeCollection. |
Replaces the specified Stroke with the specified StrokeCollection.
public:
void Replace(System::Windows::Ink::Stroke ^ strokeToReplace, System::Windows::Ink::StrokeCollection ^ strokesToReplaceWith);
public void Replace(System.Windows.Ink.Stroke strokeToReplace, System.Windows.Ink.StrokeCollection strokesToReplaceWith);
member this.Replace : System.Windows.Ink.Stroke * System.Windows.Ink.StrokeCollection -> unit
Public Sub Replace (strokeToReplace As Stroke, strokesToReplaceWith As StrokeCollection)
Parameters
- strokesToReplaceWith
- StrokeCollection
The source StrokeCollection.
Exceptions
strokesToReplace
is empty.
-or-
strokesToReplaceWith
is empty.
-or-
A Stroke in strokesToReplaceWith
is already in strokesToReplace
.
Examples
The following example demonstrates how to replace the selected strokes on an InkCanvas with another StrokeCollection. This example assumes that there is an InkCanvas called inkCanvas1
.
// Replace the selected strokes with other strokes.
private void ReplaceStrokes(StrokeCollection strokes)
{
StrokeCollection selectedStrokes = inkCanvas1.GetSelectedStrokes();
if (selectedStrokes != null && selectedStrokes.Count > 0)
{
inkCanvas1.Strokes.Replace(selectedStrokes, strokes);
}
}
' Replace the selected strokes with other strokes.
Private Sub ReplaceStrokes(ByVal strokes As StrokeCollection)
Dim selectedStrokes As StrokeCollection = inkCanvas1.GetSelectedStrokes()
If Not (selectedStrokes Is Nothing) Then
inkCanvas1.Strokes.Replace(selectedStrokes, strokes)
End If
End Sub
Remarks
The Replace method raises the StrokesChanged event.
Applies to
.NET Framework 4.8.1 dan versi lain
Produk | Versi |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Replaces the specified StrokeCollection with a new StrokeCollection.
public:
void Replace(System::Windows::Ink::StrokeCollection ^ strokesToReplace, System::Windows::Ink::StrokeCollection ^ strokesToReplaceWith);
public void Replace(System.Windows.Ink.StrokeCollection strokesToReplace, System.Windows.Ink.StrokeCollection strokesToReplaceWith);
member this.Replace : System.Windows.Ink.StrokeCollection * System.Windows.Ink.StrokeCollection -> unit
Public Sub Replace (strokesToReplace As StrokeCollection, strokesToReplaceWith As StrokeCollection)
Parameters
- strokesToReplace
- StrokeCollection
The destination StrokeCollection.
- strokesToReplaceWith
- StrokeCollection
The source StrokeCollection.
Exceptions
strokesToReplace
is empty.
-or-
strokesToReplaceWith
is empty.
-or-
A Stroke in strokesToReplaceWith
is already in strokesToReplace
.
-or-
The strokes in strokesToReplaceWith
are not continuous.
Examples
The following example demonstrates how to replace the selected strokes on an InkCanvas with another StrokeCollection. This example assumes that there is an InkCanvas called inkCanvas1
.
// Replace the selected strokes with other strokes.
private void ReplaceStrokes(StrokeCollection strokes)
{
StrokeCollection selectedStrokes = inkCanvas1.GetSelectedStrokes();
if (selectedStrokes != null && selectedStrokes.Count > 0)
{
inkCanvas1.Strokes.Replace(selectedStrokes, strokes);
}
}
' Replace the selected strokes with other strokes.
Private Sub ReplaceStrokes(ByVal strokes As StrokeCollection)
Dim selectedStrokes As StrokeCollection = inkCanvas1.GetSelectedStrokes()
If Not (selectedStrokes Is Nothing) Then
inkCanvas1.Strokes.Replace(selectedStrokes, strokes)
End If
End Sub
Remarks
The Replace method raises the StrokesChanged event for each Stroke it replaces.
Applies to
.NET Framework 4.8.1 dan versi lain
Produk | Versi |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET maklum balas
.NET ialah projek sumber terbuka. Pilih pautan untuk memberikan maklum balas: