I want to use the API function FloodFill, but I am unable to convert the device context from an IntPtr to a Long and the Color type to a long. The resulting error messages are commented below the offending code. Any suggestions?
Code:
Private Sub FloodFill(ByVal X, ByVal Y)
Dim grPictureBox As Graphics = Me.picMapArea.CreateGraphics
Dim ipDC As IntPtr = grPictureBox.GetHdc
Dim lDC = CType(ipDC, Long)
Value of type System.IntPtr cannot be converted to Long.
Dim lColor = CType(Color.Black, Long)
Value of type System.Drawing.Color cannot be converted to Long.
FloodFill(lDC, X, Y, lColor)
grPictureBox.ReleaseHdc(ipDC)
End Sub