PDA

View Full Version : DrawText solved



peter
20-11-2013, 19:10
Hi Eros,

Master Peter has solved this TextOut problem.


Uses "ui"
#INCLUDE "abc.inc"


DWord hdc, hwnd
hwnd = Canvas_Window("DRAWTEXT",xMiddle(320),yMiddle(320),320,320)
Canvas_Attach(hwnd,0,%TRUE)


hdc = Canvas_GetDC()
SetHandleDC hdc
SetFont 16,16,%FW_BOLD,""


Dim iColor(8) As Long
Long i, a, b1, z1,z2,z3
z2=5 : z3=10


b1 = LoadBmp "img/bubble.bmp",14


For i=1 To 8
a=Rand(16,200)
iColor(i) = Rgb(a,0,a)
Next


While IsWindow(hwnd) And KeyDown(27)=0
Canvas_Clear Rgb(255,255,255)

DrawText 60, 20,"HELLO",iColor(1)
DrawText 120,40,"HELLO",iColor(2)
DrawText 180,60,"HELLO",iColor(3)
DrawText 240,80,"HELLO",iColor(4)


DrawText 60, 140,"HELLO",iColor(5)
DrawText 120,120,"HELLO",iColor(6)
DrawText 180,100,"HELLO",iColor(7)

DrawBmp b1,150,140,64,64,z1
DrawBmp b1, 50,180,64,64,z2
DrawBmp b1,220,220,64,64,z3


z1 +=1
z2 +=1
z3 +=1

If z1=14 Then z1=0
If z2=14 Then z2=0
If z3=14 Then z3=0

Canvas_Redraw
Sleep 10
Wend
FreeGraphic
Canvas_Window End