Icon.ToBitmap Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
public:
System::Drawing::Bitmap ^ ToBitmap();
public System.Drawing.Bitmap ToBitmap();
member this.ToBitmap : unit -> System.Drawing.Bitmap
Public Function ToBitmap () As Bitmap
Devoluções
A Bitmap que representa o convertido Icon.
Exemplos
O exemplo de código seguinte demonstra como usar o ToBitmap método. Este exemplo foi concebido para ser usado com Windows Forms. Crie um formulário e cole o código seguinte nele. Chame o IconToBitmap método no handler de eventos da forma,Paint passando e como PaintEventArgs .
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.Exclamation, 40, 40);
// Call ToBitmap to convert it.
Bitmap bmp = icon1.ToBitmap();
// Draw the bitmap.
e.Graphics.DrawImage(bmp, new Point(30, 30));
}
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
Observações
As áreas transparentes do ícone são perdidas quando este é convertido para um bitmap, e a cor transparente do bitmap resultante é definida para RGB(13,11,12). O bitmap devolvido tem a mesma altura e largura do ícone original.