Share via


Metodo Region::GetHRGN (gdiplusheaders.h)

Il metodo Region::GetHRGN crea un'area GDI (Windows Graphics Device Interface) da questa area.

Sintassi

HRGN GetHRGN(
  [in] const Graphics *g
);

Parametri

[in] g

Tipo: grafica const *

Puntatore a un oggetto Graphics che contiene le trasformazioni del mondo e della pagina necessarie per calcolare le coordinate del dispositivo di questa area.

Valore restituito

Tipo: HRGN

Questo metodo restituisce un handle di Windows a un'area GDI creata da questa area.

Commenti

È responsabilità del chiamante chiamare la funzione GDI DeleteObject per liberare l'area GDI quando non è più necessaria.

Esempio

Nell'esempio seguente viene creata un'area GDI+ da un percorso e quindi viene usata l'area GDI+ per creare un'area GDI. Il codice usa quindi una funzione GDI per visualizzare l'area GDI.

VOID Example_GetHRGN(HDC hdc)
{
   Graphics graphics(hdc);

    Point points[] = {
      Point(110, 20),
      Point(120, 30),
      Point(100, 60),
      Point(120, 70),
      Point(150, 60),
      Point(140, 10)};

   GraphicsPath path;
   path.AddClosedCurve(points, 6);

    // Create a region from a path.
    Region pathRegion(&path);

   // Get a handle to a GDI region.
   HRGN hRegion;
   hRegion = pathRegion.GetHRGN(&graphics);

   // Use GDI to display the region.
   HBRUSH hBrush = CreateSolidBrush(RGB(255, 0, 0));
   FillRgn(hdc, hRegion, hBrush);

   DeleteObject(hBrush);
   DeleteObject(hRegion);
}

Requisiti

Requisito Valore
Client minimo supportato Windows XP, Windows 2000 Professional [solo app desktop]
Server minimo supportato Windows 2000 Server [solo app desktop]
Piattaforma di destinazione Windows
Intestazione gdiplusheaders.h (include Gdiplus.h)
Libreria Gdiplus.lib
DLL Gdiplus.dll

Vedi anche

DeleteObject

Grafica

Rect

Area