52 lines
2 KiB
Text
52 lines
2 KiB
Text
.topic ctrl.picturebox
|
|
.title PictureBox
|
|
.toc 1 PictureBox
|
|
.index PictureBox
|
|
.index Canvas
|
|
.index Drawing
|
|
.index SetPenColor
|
|
.index SetPenSize
|
|
|
|
.h1 PictureBox
|
|
|
|
VB Equivalent: PictureBox -- DVX Widget: canvas | Name Prefix: Picture
|
|
|
|
A drawing surface (canvas). Supports drawing lines, rectangles, circles, text, and individual pixels. Can save and load BMP images. The default canvas size is 64x64 pixels.
|
|
|
|
Colors are specified as 0x00RRGGBB integers (e.g. &HFF0000 for red).
|
|
|
|
.h2 Type-Specific Methods
|
|
|
|
.table
|
|
Method Description
|
|
------ -----------
|
|
Clear color% Fill the entire canvas with the specified color.
|
|
DrawLine x0%, y0%, x1%, y1%, color% Draw a line between two points.
|
|
DrawRect x%, y%, w%, h%, color% Draw a rectangle outline.
|
|
DrawText x%, y%, text$ Draw text at the given position.
|
|
FillCircle cx%, cy%, radius%, color% Draw a filled circle.
|
|
FillRect x%, y%, w%, h%, color% Draw a filled rectangle.
|
|
GetPixel(x%, y%) Returns the color at a pixel.
|
|
Load path$ Load a BMP image onto the canvas.
|
|
Resize w%, h% Resize the canvas to new dimensions.
|
|
Save path$ Save the canvas as a BMP file.
|
|
SetPenColor color% Set the drawing color for subsequent operations.
|
|
SetPenSize size% Set the pen/brush size in pixels.
|
|
SetPixel x%, y%, color% Set the color of a single pixel.
|
|
.endtable
|
|
|
|
Default Event: Click
|
|
|
|
.h2 Example
|
|
|
|
.code
|
|
Picture1.Resize 200, 150
|
|
Picture1.Clear &HFFFFFF
|
|
Picture1.SetPenSize 2
|
|
Picture1.DrawRect 10, 10, 180, 130, &H000000
|
|
Picture1.FillCircle 100, 75, 40, &HFF0000
|
|
Picture1.DrawText 60, 130, "Hello!"
|
|
Picture1.Save "output.bmp"
|
|
.endcode
|
|
|
|
.link ctrl.common.props Common Properties, Events, and Methods
|