Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Konvertiert dieses Icon in eine GDI+-Bitmap.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Function ToBitmap As Bitmap
'Usage
Dim instance As Icon
Dim returnValue As Bitmap
returnValue = instance.ToBitmap
public Bitmap ToBitmap ()
public:
Bitmap^ ToBitmap ()
public Bitmap ToBitmap ()
public function ToBitmap () : Bitmap
Rückgabewert
Eine Bitmap, die das konvertierte Icon darstellt.
Hinweise
Die transparenten Bereiche des Symbols gehen bei der Konvertierung in eine Bitmap verloren, und die transparente Farbe der resultierenden Bitmap wird auf RGB(13,11,12) festgelegt. Die zurückgegebene Bitmap hat die gleiche Höhe und Breite wie das ursprüngliches Symbol.
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.
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