• Welcome to Jose's Read Only Forum 2023.
 

GDI+: GdipSetInfinite

Started by José Roca, June 28, 2008, 06:12:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example creates a region from a rectangle, makes the region infinite, and fills the region to show the infinite region.

C++


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

   Rect rect(65, 15, 70, 45);
   SolidBrush blueBrush(Color(255, 0, 0, 255));

   // Create a rectangular region.
   Region rectRegion(rect);

   // Make the region infinite, and then fill it with a blue brush.
   rectRegion.MakeInfinite();
   graphics.FillRegion(&blueBrush, &rectRegion);
}


PowerBASIC


SUB GDIP_SetInfinite (BYVAL hdc AS DWORD)

   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pBlueBrush AS DWORD
   LOCAL pRectRegion AS DWORD
   LOCAL rc AS RECTL

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

   SetRect rc, 65, 15, 70, 45
   hStatus = GdipCreateSolidFill(GDIP_ARGB(255, 0, 0, 255), pBlueBrush)

   ' // Create a rectangular region.
   hStatus = GdipCreateRegionRectI(rc, pRectRegion)

   ' // Make the region infinite, and then fill it with a blue brush.
   hStatus = GdipSetInfinite(pRectRegion)
   hStatus = GdipFillRegion(pGraphics, pBlueBrush, pRectRegion)

   ' // Cleanup
   IF pBlueBrush THEN GdipDeleteBrush(pBlueBrush)
   IF pRectRegion THEN GdipDeleteRegion(pRectRegion)
   IF pGraphics THEN GdipDeleteGraphics(pGraphics)

END SUB


The following illustration shows the output of the preceding code.