DeleteObject
VB.Net
Imports System.Runtime.InteropServices
Module DeleteObject
<DllImport("gdi32", EntryPoint:="DeleteObject")>
Private Function DeleteObject(hObject As IntPtr) As IntPtr
End Function
Public Sub DeleteObject_Main()
' Assume 'graphics' is a Graphics object
Dim myBitmap As New Bitmap("asciipad.png")
Dim graphics As Graphics = Graphics.FromImage(myBitmap)
Dim hObject As IntPtr = graphics.GetHdc()
DeleteObject(hObject)
'' Remember to handle errors and exceptions properly when using these methods.
End Sub
End Module