• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

GDI+: GdipFillEllipse

Started by José Roca, June 23, 2008, 05:12:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example fills an ellipse that is defined by coordinates and dimensions.

C++


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

   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));

   // Initialize the variables that define the ellipse.
   REAL x = 0.0f;
   REAL y = 0.0f;
   REAL width = 200.1f;
   REAL height = 100.4f;

   // Fill the ellipse.
   graphics.FillEllipse(&blackBrush, x, y, width, height);
}


PowerBASIC


SUB GDIP_FillEllipse (BYVAL hdc AS DWORD)

   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pBrush AS DWORD
   LOCAL x AS SINGLE
   LOCAL y AS SINGLE
   LOCAL nWidth AS SINGLE
   LOCAL nHeight AS SINGLE

   hStatus = GdipCreateFromHDC(hdc, pGraphics)

   ' // Create a SolidBrush
   hStatus = GdipCreateSolidFill(GDIP_ARGB(255, 0, 0, 0), pBrush)

   ' // Create an array of PointF objects.
   x = 100.0! : y = 50.0! : nWidth = 200.1! : nHeight = 100.4!

   ' // Fill the curve.
   hStatus = GdipFillEllipse(pGraphics, pBrush, x, y, nWidth, nHeight)

   ' // Cleanup
   IF pBrush THEN GdipDeleteBrush(pBrush)
   IF pGraphics THEN GdipDeleteGraphics(pGraphics)

END SUB