Click here to Skip to main content
15,914,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pointer to a function Pin
Oliver Anhuth8-Jul-01 20:53
Oliver Anhuth8-Jul-01 20:53 
GeneralCStringList and CList problem Pin
5-Jul-01 7:54
suss5-Jul-01 7:54 
GeneralDevice Context Pin
Ryan McFarren5-Jul-01 7:33
Ryan McFarren5-Jul-01 7:33 
GeneralRe: Device Context Pin
Tim Deveaux5-Jul-01 8:29
Tim Deveaux5-Jul-01 8:29 
QuestionHow can I have multiple fonts per line using DrawTextEX? Pin
Bart-Man5-Jul-01 6:23
Bart-Man5-Jul-01 6:23 
AnswerRe: How can I have multiple fonts per line using DrawTextEX? Pin
Jim Crafton5-Jul-01 7:29
Jim Crafton5-Jul-01 7:29 
GeneralRe: How can I have multiple fonts per line using DrawTextEX? Pin
Bart-Man5-Jul-01 8:32
Bart-Man5-Jul-01 8:32 
GeneralFound a solution to the problem!! Pin
Bart-Man5-Jul-01 9:37
Bart-Man5-Jul-01 9:37 
Greetings all,

After many hours of sweat and tears I think I figured out a solution to my problem.

1.) First loop through all the fonts to find the largest font.
- Do a "GetTextExtent32()" to get the SIZE, and then do a "GetTextMetrics()".
SIZE MySize; TEXTMETRIC tm;
int nMaxAscent; int MaxLineHeight;
Now add the (MySize.cy + tm.tmDescent) together, and save them in a variable (MaxLineHeight).
Also save the tm.tmAscent in a variable (nMaxAscent).

2.) When you are drawing the font's segment, check to see if the size is less than the max font size.
- If it is smaller then figure out how much we need to offset the smaller font.
TEXTMETRIC CurrentAscent; // DO a "GetTextMetric" on your current font.

int nOffset = nMaxAscent - CurrentAscent;
Then use the offset with the rect's top.
Rect.top = Rect.top + nOffset;

3.) Finally add the descent the maxline height to the top of the rect to get the bottom.
rect.bottom = rect.top + nMaxLineHeight;

And now finally my text is lined up in a wonderful straight line!!!
It only took almost a whole day of work (and 4 mountain dews) to figure it out, SIGH!!!

Oh well, at least it works. Big Grin | :-D Big Grin | :-D Big Grin | :-D
GeneralDS problem Pin
Mihail5-Jul-01 6:02
Mihail5-Jul-01 6:02 
GeneralRe: DS problem Pin
Carlos Antollini5-Jul-01 6:17
Carlos Antollini5-Jul-01 6:17 
GeneralRe: DS problem Pin
Mihail5-Jul-01 6:54
Mihail5-Jul-01 6:54 
Generalado and excel Pin
Gérald Mercet5-Jul-01 5:39
Gérald Mercet5-Jul-01 5:39 
GeneralRe: ado and excel Pin
User 98855-Jul-01 6:16
User 98855-Jul-01 6:16 
GeneralRe: ado and excel Pin
Carlos Antollini5-Jul-01 6:26
Carlos Antollini5-Jul-01 6:26 
GeneralRe: ado and excel Pin
5-Jul-01 21:41
suss5-Jul-01 21:41 
GeneralRe: ado and excel Pin
User 98856-Jul-01 12:07
User 98856-Jul-01 12:07 
GeneralRe: ado and excel Pin
5-Jul-01 7:23
suss5-Jul-01 7:23 
QuestionHeader notifications? Pin
5-Jul-01 4:53
suss5-Jul-01 4:53 
AnswerRe: Header notifications? Pin
Tomasz Sowinski5-Jul-01 5:15
Tomasz Sowinski5-Jul-01 5:15 
GeneralRe: Header notifications? Pin
9-Jul-01 5:03
suss9-Jul-01 5:03 
QuestionHow can I hide a list control item? Pin
5-Jul-01 2:50
suss5-Jul-01 2:50 
AnswerRe: How can I hide a list control item? Pin
Tomasz Sowinski5-Jul-01 4:06
Tomasz Sowinski5-Jul-01 4:06 
QuestionHow to Print data in MSFlexgrid control in an VC++/MFC Application? Pin
Aky5-Jul-01 2:43
Aky5-Jul-01 2:43 
Generalado Pin
Gérald Mercet4-Jul-01 22:23
Gérald Mercet4-Jul-01 22:23 
QuestionHow to change File Icon Pin
Muhammad Abid4-Jul-01 22:18
Muhammad Abid4-Jul-01 22:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.