BBjDrawPanel::setDrawUnits

Description

In BBj 16.0 and higher, this method sets the units for positions and sizes on the BBjDrawPanel.

Syntax

Return Value

Method

void

setDrawUnits(int units)

Parameters

Variable

Description

units

Drawing unit:

  • 0 = Pixels (default)
  • 1 = Thousandths of an inch

Return Value

None .

Remarks

None.

Example

rem ' BBjDrawPanel::setDrawUnits

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = "BBjDrawPanel::setDrawUnits"
window! = sysgui!.addWindow(25,25,1200,750,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setTrack(0)
window!.setFont(sysgui!.makeFont("Arial",8,0))
drawpanel! = window!.getDrawPanel()
drawpanel!.setDrawUnits(1)
drawpanel!.setPenColor(BBjColor.BLUE)
drawpanel!.setFillColor(BBjColor.GREEN)
drawpanel!.setTextColor(BBjColor.BLUE)
drawpanel!.setRound(30,30)
drawpanel!.drawText(90,225,"Shape")
drawpanel!.drawText(90,495,"drawPoint")
drawpanel!.drawText(90,900,"drawRect")
drawpanel!.drawText(90,1575,"drawArc")
drawpanel!.drawText(90,2025,"drawArc")
drawpanel!.drawText(90,2925,"drawEllipse")
drawpanel!.drawText(90,3600,"drawArrow")
drawpanel!.drawText(90,4050,"drawArrow")
drawpanel!.drawText(90,4500,"drawLine")
drawpanel!.drawText(90,5175,"drawPolygon")
drawpanel!.drawText(90,6075,"drawPolyline")
for i = 0 to 10
    x = i * 900 + 225
    w = (i+1) * 0.25
    drawpanel!.setFillType(i)
    drawpanel!.setPattern(i)
    drawpanel!.setPenWidth(w)
    drawpanel!.drawPoint(x+900,450)
    drawpanel!.drawText(x+765,225,"setFillType("+str(i)+")")
    drawpanel!.drawRect(x+675,675,675,450)
    r1 = i * Math.PI / 2
    r2 = r1 + Math.PI / 2
    drawpanel!.drawArc(x+900,1575,225,1,r1,r2,1)
    drawpanel!.drawArc(x+900,2025,225,1,r1,r2,0)
    drawpanel!.drawEllipse(x+675,2475,675,450)
    adj = (i-5) * 45
    drawpanel!.moveTo(x+675,3600)
    drawpanel!.drawArrow(x+1350,3600+adj,0,1)
    drawpanel!.moveTo(x+675,4050)
    drawpanel!.drawArrow(x+1350,4050+adj,1,0)
    drawpanel!.drawLine(x+675,4500,x+1350,4725)
    points = i + 3
    list! = bbjapi().makeVector()
    for point = 0 to points-1
        angle = point * 2 * Math.PI / points
        px = int(360 * cos(angle) + 990 + x)
        py = int(360 * sin(angle) + 5400)
        list!.add(px)
        list!.add(py)
    next point
    drawpanel!.drawPolygon(list!)
    list! = bbjapi().makeVector()
    for point = 0 to points-1
        angle = point * 2 * Math.PI / points
        px = int(360 * cos(angle) + 990 + x)
        py = int(360 * sin(angle) + 6300)
        list!.add(px)
        list!.add(py)
    next point
    drawpanel!.drawPolyline(list!)
next i
process_events

eoj:
release

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjDrawPanel

DRAWUNITS Mnemonic - Set Unit of Measure for SYSGUI Drawing

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.