Font.Clone Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Membuat salinan yang tepat dari ini Font.
public:
virtual System::Object ^ Clone();
public object Clone ();
abstract member Clone : unit -> obj
override this.Clone : unit -> obj
Public Function Clone () As Object
Mengembalikan
Metode Font ini membuat, dilemparkan Objectsebagai .
Penerapan
Contoh
Contoh kode berikut dirancang untuk digunakan dengan Formulir Windows, dan memerlukan PaintEventArgse
, yang merupakan parameter penanganan Paint aktivitas. Kode mengkloning Font dan menggambar teks dengan font tersebut.
public:
void Clone_Example( PaintEventArgs^ e )
{
// Create a Font object.
System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 );
// Create a copy of myFont.
System::Drawing::Font^ cloneFont = dynamic_cast<System::Drawing::Font^>(myFont->Clone());
// Use cloneFont to draw text to the screen.
e->Graphics->DrawString( "This is a cloned font", cloneFont, Brushes::Black, 0, 0 );
}
public void Clone_Example(PaintEventArgs e)
{
// Create a Font object.
Font myFont = new Font("Arial", 16);
// Create a copy of myFont.
Font cloneFont = (Font)myFont.Clone();
// Use cloneFont to draw text to the screen.
e.Graphics.DrawString("This is a cloned font", cloneFont,
Brushes.Black, 0, 0);
}
Public Sub Clone_Example(ByVal e As PaintEventArgs)
' Create a Font object.
Dim myFont As New Font("Arial", 16)
' Create a copy of myFont.
Dim cloneFont As Font = CType(myFont.Clone(), Font)
' Use cloneFont to draw text to the screen.
e.Graphics.DrawString("This is a cloned font", cloneFont, _
Brushes.Black, 0, 0)
End Sub
Berlaku untuk
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk