Home
Products
Community
Manuals
Contact
Login or Signup

BlitzPlus Docs -> GUI - Category -> Canvases -> CreateCanvas

CreateCanvas( x,y,width,height,group )

Parameters:

x,y,width,height - Initial canvas shape
group - Group gadget handle

Description:

Creates a canvas gadget and returns its handle.

NB. do not use SetGadgetShape on a canvas unless you don't mind distorting (stretching) the actual pixels of the canvas.

See also: CanvasBuffer, FlipCanvas, MouseX, MouseY, MouseXSpeed, MouseYSpeed, HidePointer, ShowPointer, SetGadgetShape.


Comments

TAS(Posted 1+ years ago)
Tip for easy window resizing
- Make the canvas the maximum size you need.
- Lock the left and top edge down
SetGadgetLayout can,1,0,1,0
- on resie ($803) events clip the windowsize to your maximum w,h


;do not use style bit 32 as the window position will drift
WIN=CreateWindow("test",100,100,200,200,0,3)
can=CreateCanvas(0,0,300,300,win)
SetBuffer CanvasBuffer(can)
SetGadgetLayout can,1,0,1,0

Color 255,255,255
For x=0 To 6
For y=0 To 6
Rect 5+x*50,5+y*50,40,40
Next
Next
FlipCanvas can

Repeat
WaitEvent()
If EventID()=$803 Then Exit
If EventID()=$802
w=ClientHeight(win)
h=ClientHeight(win)
If w>300 Then w=300
If h>300 Then h=300
SetGadgetShape(win,GadgetX(win),GadgetY(win),w,h)
EndIf
Forever


TAS(Posted 1+ years ago)
A canvas can be the parent (container) of another canvas!


BlitzPlus Manual Forum

Blitz3D Equivalent Command