Interactive PowerBasic Forum

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Source Code => Graphics and Multimedia => GDI+ (GDI Plus) => Topic started by: José Roca on June 28, 2008, 06:12:23 PM

Title: GDI+: GdipSetInfinite
Post by: José Roca on June 28, 2008, 06:12:23 PM


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.

(http://www.jose.it-berater.org/captures/GdipSetInfinite.png)