Method function IGDIPlus.IGPGraphics.GetHDC() : HDC

From Mitov Wiki Doc
Jump to: navigation, search

This is a Beta Read Only version of this page. Please review and send recommendations to mitov@mitov.com. We will enable the editing as soon as we are happy with the overall Wiki site.

Class: IGPGraphics

Contents

Syntax

Delphi:

function GetHDC() : HDC;

C++ Builder:

HDC __fastcall GetHDC();

Visual C++ (MFC):

GetHDC();

Summary

Returns a handle to the device context associated with this TGPGraphics object.

Description

Call this method to get a handle to the device context associated with this TGPGraphics object.


Example:

The following function has a pointer to a Graphics object as its only parameter. The function calls Graphics::GetHDC to get a handle to the device context associated with the Graphics object and then passes that device context handle to the Microsoft Windows Graphics Device Interface (GDI)Rectangle function. The call to ReleaseHDC releases the device context handle.

  AGraphics.DrawEllipse( TGPPen.Create( aclBlue ), 10, 10, 100, 50);  // GDI+

  AHdc := AGraphics.GetHDC();

    // Make GDI calls, but don't call any methods
    // on g until after the call to ReleaseHDC.
    Rectangle( AHdc, 120, 10, 220, 60);  // GDI

  AGraphics.ReleaseHDC(AHdc);

  // Ok to call methods on g again.
  AGraphics.DrawLine( TGPPen.Create( aclRed ), 240, 10, 340, 60);

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox