Click here to Skip to main content
15,877,618 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello all!!


I have an SDI application, by default it should adopt 80x24 (width is 80 characters and 24 characters is height respectively need to occupy). If font size increases also it should adopt the same 80x24 characters only. means window size has to increase accordingly.

Here i'm using mono spaced font.

please send sample application or any related link.

thanks and regards sam.
Posted
Updated 29-Nov-12 18:46pm
v3
Comments
Bernhard Hiller 30-Nov-12 3:02am    
Why did you edit your question? Do you want to prevent others from learning? That deserves a downvote.
Jochen Arndt 30-Nov-12 3:29am    
I performed a rollback to the original version because there are solutions.

You could use CDC::DrawText with the DT_CALCRECT flag to compute the size (rect) of a string containing 80 charaters; use the result and compute the size of your "work area" and add a small padding buffer around it and add the width and height of the frame window (including the title bar, status bar, ... )

And use the result when creating the mainframe.


Max.
 
Share this answer
 
When the font size changes you just need to recalculate the width and height of your window based on the new TextMetric[^] values.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900