Freigeben über


Icon-Konstruktor (Icon, Int32, Int32)

Initialisiert eine neue Instanz der Icon-Klasse und sucht eine Version des Symbols, die der angeforderten Größe entspricht.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public Sub New ( _
    original As Icon, _
    width As Integer, _
    height As Integer _
)
'Usage
Dim original As Icon
Dim width As Integer
Dim height As Integer

Dim instance As New Icon(original, width, height)
public Icon (
    Icon original,
    int width,
    int height
)
public:
Icon (
    Icon^ original, 
    int width, 
    int height
)
public Icon (
    Icon original, 
    int width, 
    int height
)
public function Icon (
    original : Icon, 
    width : int, 
    height : int
)

Parameter

  • original
    Das Symbol, aus dem die geänderte Größe geladen werden soll.
  • width
    Die Breite des neuen Symbols.
  • height
    Die Höhe des neuen Symbols.

Hinweise

Wenn keine Version gefunden wird, die der Größe genau entspricht, wird die ähnlichste Entsprechung verwendet. Beachten Sie, dass diese Methode lediglich ein Duplikat des Symbols erstellt, wenn der original-Parameter ein Icon mit nur einer Größe ist. Verwenden Sie die Streckfunktionen der DrawImage-Methode, um die Größe des Symbols zu ändern.

Beispiel

Im folgenden Codebeispiel wird die Verwendung der ToBitmap-Methode veranschaulicht. Dieses Beispiel ist für die Verwendung mit Windows Forms vorgesehen. Erstellen Sie ein Formular, und fügen Sie den folgenden Code ein. Rufen Sie die IconToBitmap-Methode im Paint-Ereignishandler des Formulars auf, und übergeben Sie dabei e als PaintEventArgs-Objekt.

Private Sub IconToBitmap(ByVal e As PaintEventArgs)

    ' Construct an Icon.
    Dim icon1 As New Icon(SystemIcons.Exclamation, 40, 40)

    ' Call ToBitmap to convert it.
    Dim bmp As Bitmap = icon1.ToBitmap()

    ' Draw the bitmap.
    e.Graphics.DrawImage(bmp, New Point(30, 30))
End Sub
private void IconToBitmap(PaintEventArgs e)
{
    // Construct an Icon.
    Icon icon1 = new Icon(SystemIcons.Exclamation, 40, 40);

    // Call ToBitmap to convert it.
    Bitmap bmp = icon1.ToBitmap();

    // Draw the bitmap.
    e.Graphics.DrawImage(bmp, new Point(30, 30));
}
private:
   void IconToBitmap( PaintEventArgs^ e )
   {
      // Construct an Icon.
      System::Drawing::Icon^ icon1 = gcnew System::Drawing::Icon( SystemIcons::Exclamation,40,40 );

      // Call ToBitmap to convert it.
      Bitmap^ bmp = icon1->ToBitmap();

      // Draw the bitmap.
      e->Graphics->DrawImage( bmp, Point(30,30) );
   }
private void IconToBitmap(PaintEventArgs e)
{
    // Construct an Icon.
    Icon icon1 = new Icon(SystemIcons.get_Exclamation(), 40, 40);

    // Call ToBitmap to convert it.
    Bitmap bmp = icon1.ToBitmap();

    // Draw the bitmap.
    e.get_Graphics().DrawImage(bmp, new Point(30, 30));
} //IconToBitmap

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Icon-Klasse
Icon-Member
System.Drawing-Namespace