|
-
April 14th, 2005, 09:06 AM
#1
DrawText with integer value
Hi,
I am tring to draw text to the window to show the current year in a simulation.
int iyear;
Code:
CRect crect(10,250,150,300);
CString string = "Year : ";
pDC->DrawText(string,crect, DT_LEFT);
I would like to display the value of iyear after "Year: " either by adding it onto 'string' or by some other way.
thanks.
-
April 14th, 2005, 09:17 AM
#2
Re: DrawText with integer value
int iyear = 2005;
CRect crect(10,250,150,300);
CString string;
string.Format("Year : %d", iyear);
pDC->DrawText(string,crect, DT_LEFT);
-
April 14th, 2005, 09:23 AM
#3
Re: DrawText with integer value
nice and simple 
thanks for quick reply.
-
April 14th, 2005, 09:46 AM
#4
Re: DrawText with integer value
Hi,
I have just tried it with a population value that rises and falls. The trouble is if the population is above 100 so 3 figures. If it then falls bellow 100 down to 2 figure the 3rd figure is still displayed.
so if value is 101 then drops to 91 it is displaying 911.
Is there a way around this problem?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|