Dil

Icon.ToBitmap Yöntem

Tanım

Bunu Icon GDI+ Bitmapdeğerine dönüştürür.

public:
 System::Drawing::Bitmap ^ ToBitmap();
public System.Drawing.Bitmap ToBitmap();
member this.ToBitmap : unit -> System.Drawing.Bitmap
Public Function ToBitmap () As Bitmap

Döndürülenler

Bitmap Dönüştürülen Iconöğesini temsil eden bir .

Örnekler

Aşağıdaki kod örneği, yönteminin ToBitmap nasıl kullanılacağını gösterir. Bu örnek, Windows Forms ile kullanılacak şekilde tasarlanmıştır. Bir form oluşturun ve içine aşağıdaki kodu yapıştırın. IconToBitmap yöntemini formun .Paint olay işleyicisinde olarak e geçirerek çağırınPaintEventArgs.

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

Açıklamalar

Simgenin saydam alanları bit eşlem haline dönüştürüldüğünde kaybolur ve sonuçta elde edilen bit eşlemin saydam rengi olarak RGB(13,11,12)ayarlanır. Döndürülen bit eşlem, özgün simgeyle aynı yüksekliğe ve genişliğe sahiptir.

Şunlara uygulanır