Click here to Skip to main content
12,892,596 members (48,010 online)
Rate this:
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 Sam725
Updated 29-Nov-12 18:46pm
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.
Rate this: bad
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.

Rate this: bad
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.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100