Freigeben über


Icon-Klasse

Stellt ein Windows-Symbol dar, bei dem es sich um ein Bitmap-Bild zur Darstellung eines Objekts handelt. Symbole lassen sich als transparente Bitmaps vorstellen, deren Größe jedoch durch das System bestimmt wird.

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

Syntax

'Declaration
<SerializableAttribute> _
Public NotInheritable Class Icon
    Inherits MarshalByRefObject
    Implements ISerializable, ICloneable, IDisposable
'Usage
Dim instance As Icon
[SerializableAttribute] 
public sealed class Icon : MarshalByRefObject, ISerializable, ICloneable, IDisposable
[SerializableAttribute] 
public ref class Icon sealed : public MarshalByRefObject, ISerializable, ICloneable, IDisposable
/** @attribute SerializableAttribute() */ 
public final class Icon extends MarshalByRefObject implements ISerializable, ICloneable, 
    IDisposable
SerializableAttribute 
public final class Icon extends MarshalByRefObject implements ISerializable, ICloneable, 
    IDisposable

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

Vererbungshierarchie

System.Object
   System.MarshalByRefObject
    System.Drawing.Icon

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, 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

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Icon-Member
System.Drawing-Namespace