This method retrieves the image from the screen device context.

[Visual Basic]   [ Long = ]imagekitcontrolname.PrintDraw.GetImageFromHdc(hDC As LONG_PTR, Width As Long, Height As Long, BitCount As Integer)
[Visual C++]     [ long = ]imagekitcontrolname.GetPrintDraw().GetImageFromHdc(LONG_PTR hDC, long Width, long Height, short BitCount)
[VB.NET]   [ Integer = ]imagekitcontrolname.PrintDraw.GetImageFromHdc(hDC As Integer(x86) or Long(x64), Width As Integer, Height As Integer, BitCount As Short)
[C#.NET]   [ int = ]imagekitcontrolname.PrintDraw.GetImageFromHdc(int(x86) or long(x64) hDC, int Width, int Height, short BitCount)

* (x86) refers to the 32 bit version, (x64) refers to the 64 bit version.

Parameters

Name Explanation
hDC The screen device context
Width The width of the retrieved image (in pixels)
Height The height of the retrieved image (in pixels)
BitCount The number of bits per pixels in the image you want to create

Return Value

Returns the image handle of the raster image if successful, returns NULL (0) when not successful.

Explanation

The GetImageFromHdc method retrieves the image from the screen device context and returns it to the image data.

Note: Some components such as a PictureBox, do not always retrieve the height and width of the actual image. In such cases there can be problems with the GetImageFromHdc method retrieving the image from the screen device context.

Differences between the ImageKit7/8

The hDC argument type has changed.

The ImageKit10 ActiveX is a product created by Newtone Corporation