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.
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);
Re: DrawText with integer value
nice and simple :)
thanks for quick reply.
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?