x = DrawText(x, y, Text$)
Publié : lun. 06/févr./2006 23:13
Un truc sympa vu sur le forum anglais :
DrawText retourne la position X de fin du text, permettant de concaténer plusieurs DrawText.
Lien vers le post anglais
DrawText retourne la position X de fin du text, permettant de concaténer plusieurs DrawText.
Code : Tout sélectionner
;
; ------------------------------------------------------------
;
; PureBasic - 2D Drawing example file
;
; (c) 2005 - Fantaisie Software
;
; ------------------------------------------------------------
;
If OpenWindow(0, 100, 200, 300, 200, #PB_Window_SystemMenu, "2D Drawing Test")
; Create an offscreen image, with a green circle in it.
; It will be displayed later
;
If CreateImage(0, 300, 200)
If StartDrawing(ImageOutput(0))
Circle(100,100,50,RGB(0,0,255)) ; a nice blue circle...
Box(150,20,20,20, RGB(0,255,0)) ; and a green box
FrontColor(RGB(255,0,0)) ; Finally, red lines..
For k=0 To 20
LineXY(10,10+k*8,200, 0)
Next
DrawingMode(1)
; Locate(10, 50)
BackColor(RGB(0,155,155)) ; Change the text back and front colour
FrontColor(RGB(255,255,255))
x = 10
y = 50
x = DrawText(x,y,"Hello, ")
DrawText(x,y,"this is a test")
StopDrawing()
EndIf
EndIf
; Create a gadget to display our nice image
;
CreateGadgetList(WindowID(0))
ImageGadget(0, 0, 0, 0, 0, ImageID(0))
;
; This is the 'event loop'. All the user actions are processed here.
; It's very easy to understand: when an action occurs, the EventID
; isn't 0 and we just have to see what have happened...
;
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow ; If the user has pressed on the window close button
EndIf
End