Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Win32 MFC
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 27-Nov-12 3:54am
Mr Sam679
Edited 29-Nov-12 18:46pm
v3
Comments
Bernhard Hiller at 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 at 30-Nov-12 3:29am
   
I performed a rollback to the original version because there are solutions.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

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



Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 30 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid