共用方式為


DrawingAttributes.Clone 方法

定義

複製 DrawingAttributes 物件。

public:
 virtual System::Windows::Ink::DrawingAttributes ^ Clone();
public virtual System.Windows.Ink.DrawingAttributes Clone ();
abstract member Clone : unit -> System.Windows.Ink.DrawingAttributes
override this.Clone : unit -> System.Windows.Ink.DrawingAttributes
Public Overridable Function Clone () As DrawingAttributes

傳回

DrawingAttributes 物件的複本。

範例

下列範例示範如何複製 DrawingAttributes 物件。

void CopyAttributes(Stroke someStroke)
{
    DrawingAttributes attributes = new DrawingAttributes();
    attributes.Color = Colors.Red;
    someStroke.DrawingAttributes = attributes.Clone();
}
Sub CopyAttributes(ByVal someStroke As Stroke)
    Dim attributes As New DrawingAttributes()
    attributes.Color = Colors.Red
    someStroke.DrawingAttributes = attributes.Clone()
End Sub

備註

方法 Clone 會建立新的 DrawingAttributes 物件,並填入與目前 物件相同的值。 也會複製任何自訂屬性。

適用於

另請參閱