Bitmap.GetHbitmap 메서드

정의

GDI+ Bitmap에서 GDI 비트맵 개체를 만듭니다.

오버로드

GetHbitmap()

Bitmap에서 GDI 비트맵 개체를 만듭니다.

GetHbitmap(Color)

Bitmap에서 GDI 비트맵 개체를 만듭니다.

GetHbitmap()

Source:
Bitmap.cs
Source:
Bitmap.cs
Source:
Bitmap.cs

Bitmap에서 GDI 비트맵 개체를 만듭니다.

public:
 IntPtr GetHbitmap();
public IntPtr GetHbitmap ();
member this.GetHbitmap : unit -> nativeint
Public Function GetHbitmap () As IntPtr

반환

IntPtr

nativeint

이 메서드가 만드는 GDI 비트맵 개체에 대한 핸들입니다.

예외

비트맵의 높이 또는 너비가 Int16.MaxValue보다 큽 수 있습니다.

작업이 실패했습니다.

예제

다음 코드 예제에서는 GetHbitmap 메서드를 사용하는 방법을 보여 줍니다.

   [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")]
   static bool DeleteObject( IntPtr hObject );

private:
   void DemonstrateGetHbitmap()
   {
      Bitmap^ bm = gcnew Bitmap( "Picture.jpg" );
      IntPtr hBitmap = bm->GetHbitmap();
      
      // Do something with hBitmap.
      DeleteObject( hBitmap );
   }
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern bool DeleteObject(IntPtr hObject);

private void DemonstrateGetHbitmap()
{
    Bitmap bm = new Bitmap("Picture.jpg");
    IntPtr hBitmap = bm.GetHbitmap();

    // Do something with hBitmap.
    DeleteObject(hBitmap);
}
<System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")> _
    Private Shared Function DeleteObject (ByVal hObject As IntPtr) As Boolean
    End Function
   


    Private Sub DemonstrateGetHbitmap()
        Dim bm As New Bitmap("Picture.jpg")
        Dim hBitmap As IntPtr
        hBitmap = bm.GetHbitmap()

        ' Do something with hBitmap.
        DeleteObject(hBitmap)
    End Sub

설명

GDI DeleteObject 비트맵 개체에서 사용하는 메모리를 해제하기 위해 GDI 메서드를 호출해야 합니다. GDI 비트맵에 대한 자세한 내용은 Windows GDI 설명서의 비트맵 을 참조하세요.

적용 대상

GetHbitmap(Color)

Source:
Bitmap.cs
Source:
Bitmap.cs
Source:
Bitmap.cs

Bitmap에서 GDI 비트맵 개체를 만듭니다.

public:
 IntPtr GetHbitmap(System::Drawing::Color background);
public IntPtr GetHbitmap (System.Drawing.Color background);
member this.GetHbitmap : System.Drawing.Color -> nativeint
Public Function GetHbitmap (background As Color) As IntPtr

매개 변수

background
Color

배경색을 지정하는 Color 구조체입니다. 해당 비트맵이 완전히 불투명하면 이 매개 변수는 무시됩니다.

반환

IntPtr

nativeint

이 메서드가 만드는 GDI 비트맵 개체에 대한 핸들입니다.

예외

비트맵의 높이 또는 너비가 Int16.MaxValue보다 큽 수 있습니다.

작업이 실패했습니다.

예제

다음 코드 예제에서는 .method를 사용하는 GetHbitmap방법을 보여 줍니다.

void DemonstrateGetHbitmapWithColor()
{
   Bitmap^ bm = gcnew Bitmap( "Picture.jpg" );
   IntPtr hBitmap = bm->GetHbitmap( Color::Blue );
   
   // Do something with hBitmap.
   DeleteObject( hBitmap );
}

private void DemonstrateGetHbitmapWithColor()
{
    Bitmap bm = new Bitmap("Picture.jpg");
    IntPtr hBitmap = bm.GetHbitmap(Color.Blue);

    // Do something with hBitmap.
    DeleteObject(hBitmap);
}

Private Sub DemonstrateGetHbitmapWithColor()
    Dim bm As New Bitmap("Picture.jpg")
    Dim hBitmap As IntPtr
    hBitmap = bm.GetHbitmap(Color.Blue)

    ' Do something with hBitmap.
    DeleteObject(hBitmap)
End Sub

설명

GDI DeleteObject 비트맵 개체에서 사용하는 메모리를 해제하기 위해 GDI 메서드를 호출해야 합니다. GDI 비트맵에 대한 자세한 내용은 Windows GDI 설명서의 비트맵 을 참조하세요.

적용 대상