|
From: Abhijit S. <mu...@gm...> - 2002-08-04 09:06:08
|
Greets, Carlos.
> I want create a bitmap for hold a text string loaded from a file. I have
> a fixed width, given by the window, but the height depends on the string
> length, but I don't see any function in the win32 reference which could
> be used for achieve it in a simple way. Though in it is claimed that the
> result is width and height GetExtentPoint32 gives the dimensions of the
> string without considering that it will be displayed in multiple lines,
> so it gives a lpsize which has the cx length of all the characters of
> the string and the height of a single line. If I try to work with it in
> the simple ways (cy = cx /window widht * text height) I get a too short
I think this should be
cy = (cx / window_width + 1) * text_height
since for cx/window_width == 0, there is actually one line already (for
example, 300/400 is 0, but there is one line of width 300 units). You might
also want to have a variable for line spacing.
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|