Get String size Height and Width
-
Hi, I am new to Win-32 C++. and i want to get the string size (Height and Width) of a string Like ( In VB.Net )
Dim strSize As SizeF
strSize = e.Graphics.MeasureString("Mitesh Khatri", New Font("Sans Serif", 9, FontStyle.Bold))How i get same thing in Win-32 C++. Please suggest. Thanks
~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA
-
Hi, I am new to Win-32 C++. and i want to get the string size (Height and Width) of a string Like ( In VB.Net )
Dim strSize As SizeF
strSize = e.Graphics.MeasureString("Mitesh Khatri", New Font("Sans Serif", 9, FontStyle.Bold))How i get same thing in Win-32 C++. Please suggest. Thanks
~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA
How are you displaying the string ? Using CDC::TextOut ? If yes, then you can use CDC::GetTextExtent[^]
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
Hi, I am new to Win-32 C++. and i want to get the string size (Height and Width) of a string Like ( In VB.Net )
Dim strSize As SizeF
strSize = e.Graphics.MeasureString("Mitesh Khatri", New Font("Sans Serif", 9, FontStyle.Bold))How i get same thing in Win-32 C++. Please suggest. Thanks
~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA
-
Hi, I am new to Win-32 C++. and i want to get the string size (Height and Width) of a string Like ( In VB.Net )
Dim strSize As SizeF
strSize = e.Graphics.MeasureString("Mitesh Khatri", New Font("Sans Serif", 9, FontStyle.Bold))How i get same thing in Win-32 C++. Please suggest. Thanks
~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA
To further clarify what Cedric said, you first get a device context, select the font you be using into it and then all GetTextExtent(). (This may sound obvious to experienced developers, but the failure to select the font is a common mistake.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke