Font.Clone Method
Definition
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.
Creates an exact copy of this Font.
public:
virtual System::Object ^ Clone();
public object Clone ();
abstract member Clone : unit -> obj
override this.Clone : unit -> obj
Public Function Clone () As Object
Returns
The Font this method creates, cast as an Object.
Implements
Examples
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, which is a parameter of the Paint event handler. The code clones a Font and draws text with that font.
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
Applies to
Colaborați cu noi pe GitHub
Sursa pentru acest conținut poate fi găsită pe GitHub, unde puteți, de asemenea, să creați și să consultați probleme și solicitări de tragere. Pentru mai multe informații, consultați ghidul nostru pentru colaboratori.