Requires: Direct2D.lg32
D2Box draws a rectangle in the render target's drawing area, while D2PBox draws a filled rectangle in the render target's drawing area.
D2Box x1!, y1!, x2!, y2! [,D2Brush] D2PBox x1!, y1!, x2!, y2! [,D2Brush]
x1!, y!, x2!, y2! | : float expression |
D2Brush | : Object expression |
D2Box draws the outline of a rounded rectangle from x1,y1 to x2,y2 in device-independent pixels. By default, the outline is drawn using a solid color brush created from the current foreground color D2ForeColor. If the application passes a D2Brush object, the stroke (line) is painted with that brush. Use D2DefLine to set the line style and width.
D2PBox draws a filled rectangle from x1,y1 to x2,y2 in device-independent pixels. By default, the rectangle's interior is painted using the brush set with D2DefFill. If the application specified a brush object with the D2PBox command, the interior is painted with that brush. The outline of the rectangle is painted using the current foreground color. To prevent the painting of the outline set line-width to zero using D2DefLine , 0.
'
' D2(P)Box sample (dpi-unaware)
'
$Library "direct2d"
Global Object Win1RT
OpenW 1, 0, 0, 320, 360, ~15
Set Win1RT = D2GetRT()
Do
Sleep
Until Me Is Nothing
Sub Win_1_Paint
D2BeginDraw Win1RT, D2C_White
D2ForeColor = D2C_Brown
D2Box 20, 20, 120, 120
D2DefLine , 0 ' no outline
D2PBox 20, 150, 120, 270
' Create and select a 50% transparent fillpattern
D2DefLine ' restore default
D2DefFill ARGB(128, 0, 128, 0)
D2Box 70, 20, 240, 120
D2DefLine , 0 ' no outline
D2PBox 70, 150, 240, 270
D2EndDraw
EndSub
Requires an active render target, either set with D2BeginDraw or D2SetRT.
All drawing commands must be placed between D2BeginDraw and D2EndDraw.
D2Box invokes the ID2D1RenderTarget::DrawRectangle method and D2PBox invokes the ID2D1RenderTarget::FillRectangle method.
D2PRBox, D2RBox, D2Line, D2SetRT, D2DefFill, D2DefLine, D2Brush, D2BeginDraw, D2EndDraw
{Created by Sjouke Hamstra; Last updated: 15/03/2021 by James Gaite}