Graphics.FromHwnd Method (IntPtr)
.NET Framework (current version)
Creates a new Graphics from the specified handle to a window.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- hwnd
-
Type:
System.IntPtr
Handle to a window.
Return Value
Type: System.Drawing.GraphicsThis method returns a new Graphics for the specified window handle.
The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler, as well as thisForm, the Form for the example. The code performs the following actions:
SecurityPermission
for access to unmanaged code. Related enumeration: UnmanagedCode.
.NET Framework
Available since 1.1
Available since 1.1
Show: