Click here to Skip to main content
15,900,973 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Edit Box Question Pin
Shog926-May-02 14:33
sitebuilderShog926-May-02 14:33 
GeneralRe: Edit Box Question Pin
Nish Nishant26-May-02 14:54
sitebuilderNish Nishant26-May-02 14:54 
GeneralRe: Edit Box Question Pin
Shog926-May-02 16:02
sitebuilderShog926-May-02 16:02 
GeneralRe: Edit Box Question Pin
Shog926-May-02 16:04
sitebuilderShog926-May-02 16:04 
GeneralRe: Edit Box Question Pin
DanYELL27-May-02 3:14
DanYELL27-May-02 3:14 
GeneralRe: Edit Box Question Pin
Shog927-May-02 8:05
sitebuilderShog927-May-02 8:05 
GeneralRe: Edit Box Question Pin
DanYELL27-May-02 9:22
DanYELL27-May-02 9:22 
GeneralRe: Edit Box Question Pin
Shog927-May-02 9:53
sitebuilderShog927-May-02 9:53 
Alright, that's a bit easier. Here's what you can do:

  1. Retrieve the text
  2. Retrieve the inner width of the list box
  3. Get a screen DC (used only for measuring the text): (MFC)CClientDC dc(NULL);
  4. Get the font used in the edit box: (MFC)pWndEdit->GetFont();
  5. Parse out the string one word at a time, measuring each word, and accumulating the lengths (don't forget to measure spaces & tabs). When you are unable to add another word without exceeding the width of the list box, insert "\r\n" and reset the accumulated length. Use (MFC) CSize sizeWord = dc.GetTextExtent(strWord);

Have Fun!

--------

A closed mouth gathers no foot.

--Shog9 --


QuestionWeird ostream/facet/DLL/ problem...? Pin
Taka Muraoka26-May-02 13:25
Taka Muraoka26-May-02 13:25 
AnswerRe: Weird ostream/facet/DLL/ problem...? Pin
Joaquín M López Muñoz26-May-02 19:51
Joaquín M López Muñoz26-May-02 19:51 
Generalhelp me! Pin
26-May-02 13:12
suss26-May-02 13:12 
GeneralRe: help me! Pin
Christian Graus26-May-02 13:21
protectorChristian Graus26-May-02 13:21 
Questionwho knows how to play .mpeg files in MFC or by APIs? Pin
Atilla Selem26-May-02 10:15
Atilla Selem26-May-02 10:15 
AnswerRe: who knows how to play .mpeg files in MFC or by APIs? Pin
Mazdak26-May-02 10:15
Mazdak26-May-02 10:15 
AnswerRe: who knows how to play .mpeg files in MFC or by APIs? Pin
Christian Graus26-May-02 13:22
protectorChristian Graus26-May-02 13:22 
GeneralSubject: Drag & Drop tutorial or sample !!! Pin
Hadi Rezaee26-May-02 8:16
Hadi Rezaee26-May-02 8:16 
GeneralRe: Subject: Drag & Drop tutorial or sample !!! Pin
Nish Nishant26-May-02 14:25
sitebuilderNish Nishant26-May-02 14:25 
GeneralRe: Subject: Drag & Drop tutorial or sample !!! Pin
Hadi Rezaee26-May-02 16:30
Hadi Rezaee26-May-02 16:30 
GeneralGlobal Variables Pin
laphijia26-May-02 6:58
laphijia26-May-02 6:58 
GeneralRe: Global Variables Pin
Paul M Watt26-May-02 6:57
mentorPaul M Watt26-May-02 6:57 
GeneralRe: Global Variables Pin
Christian Graus26-May-02 13:23
protectorChristian Graus26-May-02 13:23 
GeneralRe: Global Variables Pin
Rick York26-May-02 13:43
mveRick York26-May-02 13:43 
Generalanother icon question... Pin
l a u r e n26-May-02 6:51
l a u r e n26-May-02 6:51 
GeneralRe: another icon question... Pin
Michael Dunn26-May-02 7:15
sitebuilderMichael Dunn26-May-02 7:15 
GeneralRe: another icon question... Pin
l a u r e n26-May-02 7:28
l a u r e n26-May-02 7:28 

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.