Page 1 of 1
Window output canvas
Posted: Tue Sep 23, 2025 11:55 am
by rndrei
How to display canvas in a specific window?
WindowsOutput(#win) do not offer. It is canvas to be displayed in a certain window!
Code: Select all
If StartDrawing(CanvasOutput(canvas))
Box(10,10,200,200,#Black)
DrawText(25, 20, "Test canvas", #white, #black)
StopDrawing()
Re: Window output canvas
Posted: Tue Sep 23, 2025 12:06 pm
by RASHAD
You have to create first the
Canvas Gadget
Code: Select all
OpenWindow(?,?,?,?,?,"",flags)
Canvas = CanvasGadget(#PB_Any,0,0,220,220)
If StartDrawing(CanvasOutput(canvas))
DrawingMode(#PB_2DDrawing_Transparent)
Box(10,10,200,200,#Black)
DrawText(25, 20, "Test canvas", #white, #black)
StopDrawing()
endif
Re: Window output canvas
Posted: Tue Sep 23, 2025 12:14 pm
by rndrei
I have 2 windows, I have a canvas, how can I bring the canvas to a certain window?
Code: Select all
#window_1=10
#window_2=11
#canvas_1=12
OpenWindow(#WINDOW_1,0,0,250,250, "window 1", #PB_Window_WindowCentered)
OpenWindow(#WINDOW_2,300,300,250,250, "window 2", #PB_Window_WindowCentered)
CanvasGadget(#canvas_1, 0, 50,50 , 24)
Repeat
Event_CS = WaitWindowEvent()
If StartDrawing(CanvasOutput(#canvas_1))
Box(50,50,100,200,#Black)
DrawText(35, 30, "Test canvas", #Red, #Yellow)
StopDrawing()
EndIf
Until Event_CS = #PB_Event_CloseWindow
Re: Window output canvas
Posted: Tue Sep 23, 2025 12:18 pm
by Mindphazer
Your Canvas is drawn on the last window created
UseGadgetList(WindowID) to select the window on which your canvas will be drawn
Re: Window output canvas
Posted: Tue Sep 23, 2025 12:32 pm
by rndrei
work it! thank`s!