Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Integer variable in Font.Draw
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jas




PostPosted: Wed Apr 06, 2005 7:37 pm   Post subject: Integer variable in Font.Draw

code:

var num : int
get num
var font2 : int := (Font.New ("Times New Roman:15:bold,"))
Font.Draw (num, 300,250,font2,white)
Font.Free (font2)


In the above program, i get an error that says "argument is the wrong type" in the Font.Draw line at the "num" variable.

This is probably because you cant have a variable that is an integer in that position. If i assign num as a string, and the user inputs an integer, it works. But i cant do that because the rest of my program involves that variable(in for loops), and it has to be an integer . Is there any way you can make this program work with leaving num as an integer?
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Wed Apr 06, 2005 7:49 pm   Post subject: (No subject)

First of all, you only need this for the font
code:

var font :int := Font.New ("Comic Sans MS:10:bold") % or w/e

secondly, use intstr, such as
code:
Font.Draw(intstr(num),10,10,font,2)

you can also set another variable to the string value of the number, juss do this
code:
var fart :string := intstr(num)


I'm sure there's tutorials on this somewhere, juss look around.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: