BCX_RECTANGLE function

Purpose : BCX_RECTANGLE draws a rectangle, optionally filling it.


Syntax:

 RetVal = BCX_RECTANGLE(HndlWnd AS HWND, _
                        Left AS INTEGER, _
                         Top AS INTEGER, _
                       Right AS INTEGER, _
                      Bottom AS INTEGER, _
                      [, Pen AS INTEGER] _
                     [, Fill AS INTEGER] _
                      [, DrawHDC AS HDC])

Return Value:

  • Data type: INTEGER
    RetVal is a nonzero integer if the function succeeds, zero if the function fails.

Parameters:

  • Data type: HWND
    HndlWnd identifies the window where drawing takes place.
    The HndlWnd parameter must be set to 0 if printing to an HDC.
  • Data type: INTEGER
    Left horizontal X-coordinate of the upper-left corner of a bounding rectangle.
  • Data type: INTEGER
    Top vertical Y-coordinate of the upper-left corner of a bounding rectangle.
  • Data type: INTEGER
    Right horizontal X-coordinate of the lower-right corner of a bounding rectangle.
  • Data type: INTEGER
    Bottom vertical Y-coordinate of the lower-right corner of a bounding rectangle.
  • Data type: INTEGER
    Pen [OPTIONAL] integer representing the RGB color code. The default is 0 which is a black pen.
    The Pen width, in pixels, can be set with the case insensitive BCX_PENSIZE GLOBAL variable.
  • Data type: INTEGER
    Fill [OPTIONAL] integer 0 or 1. The default is zero which will not fill the rectangle. A value of 1 will fill the rectangle with the color defined in the Pen parameter.
  • DrawHDC [OPTIONAL] HDC (Handle to Device Context) pointing to an already open HDC. This is useful if a device context is to be written to many times. In this case the programmer is responsible for closing the HDC at the appropriate time.
    If printing to an HDC, the HndlWnd parameter, above, must be set to 0.

BCX_ROUNDRECT function

Purpose: BCX_ROUNDRECT draws a rounded rectangle, optionally filling it.


Syntax:

 RetVal = BCX_ROUNDRECT(HndlWnd AS HWND, _
                        Left AS INTEGER, _
                         Top AS INTEGER, _
                       Right AS INTEGER, _
                      Bottom AS INTEGER, _
                       Width AS INTEGER, _
                      Height AS INTEGER  _
                      [, Pen AS INTEGER] _
                     [, Fill AS INTEGER] _
                      [, DrawHDC AS HDC])

Return Value:

  • Data type: INTEGER
    RetVal is a nonzero integer if the function succeeds, zero if the function fails.

Parameters:

  • Data type: HWND
    HndlWnd identifies the window where drawing takes place.
    The HndlWnd parameter must be set to 0 if printing to an HDC.
  • Data type: INTEGER
    Left horizontal X-coordinate of the upper-left corner of a bounding rectangle.
  • Data type: INTEGER
    Top vertical Y-coordinate of the upper-left corner of a bounding rectangle.
  • Data type: INTEGER
    Right horizontal X-coordinate of the lower-right corner of a bounding rectangle.
  • Data type: INTEGER
    Bottom vertical Y-coordinate of the lower-right corner of a bounding rectangle.
  • Data type: INTEGER
    Width width of ellipse used to draw the rounded corners.
  • Data type: INTEGER
    Height height of ellipse used to draw the rounded corners.
  • Data type: INTEGER
    Pen [OPTIONAL] integer representing the RGB color code. The default is 0 which is a black pen.
    The Pen width, in pixels, can be set with the case insensitive BCX_PENSIZE GLOBAL variable.
  • Data type: INTEGER
    Fill [OPTIONAL] integer 0 or 1. The default is zero which will not fill the ellipse. A value of 1 will fill the ellipse with the color defined in the Pen parameter.
  • DrawHDC [OPTIONAL] HDC (Handle to Device Context) pointing to an already open HDC. This is useful if a device context is to be written to many times. In this case the programmer is responsible for closing the HDC at the appropriate time.
    If printing to an HDC, the HndlWnd parameter, above, must be set to 0.

Example:


 GUI "BCX_RECTANGLE"
  
  SUB FORMLOAD
    GLOBAL Form1 AS HWND
    Form1 = BCX_FORM("BCX_RECTANGLE", 0, 0, 135, 120)
    BCX_SET_FORM_COLOR(Form1, RGB(255,255,255))
    CENTER(Form1)
    SHOW(Form1)
  END SUB
    
  BEGIN EVENTS
    SELECT CASE CBMSG
    CASE WM_PAINT
      CALL DrawStuff
  
    CASE WM_CLOSE
      DestroyWindow(Form1)
      EXIT FUNCTION
  
    END SELECT
  END EVENTS
    
  SUB DrawStuff
    BCX_RECTANGLE(Form1,40,20,220,200,RGB(0x00,0x66,0x06),TRUE)
    BCX_ROUNDRECT(Form1,79,59,180,160,20,20,0x000000,FALSE)
    BCX_ROUNDRECT(Form1,78,58,180,160,20,20,0x000000,FALSE)
    BCX_ROUNDRECT(Form1,80,60,180,160,20,20,0xFFFFFF,FALSE)
    BCX_ROUNDRECT(Form1,80,60,181,161,20,20,0xFFFFFF,FALSE)
    BCX_ROUNDRECT(Form1,80,60,179,159,20,20,RGB(0xEF,0xE7,0xCF),TRUE)
  END SUB