Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why can't it show a whole bitmap in listctrl in icon form Pin
James R. Twine19-Jun-07 7:01
James R. Twine19-Jun-07 7:01 
GeneralRe: Why can't it show a whole bitmap in listctrl in icon form Pin
Mark Salsbery19-Jun-07 7:56
Mark Salsbery19-Jun-07 7:56 
QuestionZoom in PRSDK (Canon SDSK supporting Power shot A640) Pin
Johnbrithol18-Jun-07 23:15
Johnbrithol18-Jun-07 23:15 
QuestionHow to resize CEdit dynamically? Pin
Soleil couchant18-Jun-07 23:06
Soleil couchant18-Jun-07 23:06 
AnswerRe: How to resize CEdit dynamically? Pin
Rage18-Jun-07 23:29
professionalRage18-Jun-07 23:29 
AnswerRe: How to resize CEdit dynamically? Pin
David Crow19-Jun-07 2:53
David Crow19-Jun-07 2:53 
AnswerRe: How to resize CEdit dynamically? Pin
bob1697219-Jun-07 4:46
bob1697219-Jun-07 4:46 
AnswerRe: How to resize CEdit dynamically? Pin
Mark Salsbery19-Jun-07 7:42
Mark Salsbery19-Jun-07 7:42 
Here's some code you can play with - it's the closest I could get on a single-line edit control.
Multiline edit controls may work better since they allow you to change the formatting rect.
Hopefully this will give you a general idea of a way to do it Smile | :)
CString str = _T("Test Text");
 
// Get text extent
CFont *pFont = m_Edit1Edit.GetFont();
CWindowDC dc(this);
CFont *pOldFont = dc.SelectObject(pFont);
CSize TextSize = dc.GetTextExtent(str);
dc.SelectObject(pOldFont);
 
// Calculate the new size and resize the control
CRect WindowRect;
CRect ClientRect;
CRect FormatRect;
m_Edit1Edit.GetWindowRect(&WindowRect);
m_Edit1Edit.GetClientRect(&ClientRect);
m_Edit1Edit.GetRect(&FormatRect);
CSize BorderSize;
BorderSize.cx = WindowRect.Width() - FormatRect.Width();
BorderSize.cy = WindowRect.Height() - ClientRect.Height();
m_Edit1Edit.SetWindowPos(0, 0, 0, TextSize.cx + BorderSize.cx, TextSize.cy + BorderSize.cy, SWP_NOZORDER | SWP_NOMOVE);
 
// Set the control's text 
m_Edit1Edit.SetWindowText(str);




"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

Questionhow to set text in different fonts in defferent lines of static text control Pin
Banks K18-Jun-07 23:01
Banks K18-Jun-07 23:01 
AnswerRe: how to set text in different fonts in defferent lines of static text control Pin
Rage18-Jun-07 23:30
professionalRage18-Jun-07 23:30 
GeneralRe: how to set text in different fonts in defferent lines of static text control Pin
Banks K19-Jun-07 0:00
Banks K19-Jun-07 0:00 
GeneralRe: how to set text in different fonts in defferent lines of static text control Pin
Iain Clarke, Warrior Programmer19-Jun-07 0:16
Iain Clarke, Warrior Programmer19-Jun-07 0:16 
GeneralRe: how to set text in different fonts in defferent lines of static text control Pin
Hamid_RT19-Jun-07 0:45
Hamid_RT19-Jun-07 0:45 
Questionread data from text file, extract and display in excel format Pin
mrr218-Jun-07 22:47
mrr218-Jun-07 22:47 
AnswerRe: read data from text file, extract and display in excel format [modified] Pin
Rage18-Jun-07 23:37
professionalRage18-Jun-07 23:37 
GeneralRe: read data from text file, extract and display in excel format Pin
Iain Clarke, Warrior Programmer19-Jun-07 0:20
Iain Clarke, Warrior Programmer19-Jun-07 0:20 
GeneralRe: read data from text file, extract and display in excel format Pin
Rage19-Jun-07 0:23
professionalRage19-Jun-07 0:23 
AnswerRe: read data from text file, extract and display in excel format Pin
Iain Clarke, Warrior Programmer19-Jun-07 0:28
Iain Clarke, Warrior Programmer19-Jun-07 0:28 
AnswerRe: read data from text file, extract and display in excel format Pin
David Crow19-Jun-07 4:00
David Crow19-Jun-07 4:00 
QuestionWizard Style Dialogs Pin
Abhijeet Pathak18-Jun-07 22:39
Abhijeet Pathak18-Jun-07 22:39 
AnswerRe: Wizard Style Dialogs Pin
_AnsHUMAN_ 18-Jun-07 22:43
_AnsHUMAN_ 18-Jun-07 22:43 
GeneralRe: Wizard Style Dialogs Pin
Abhijeet Pathak18-Jun-07 22:49
Abhijeet Pathak18-Jun-07 22:49 
GeneralRe: Wizard Style Dialogs Pin
_AnsHUMAN_ 18-Jun-07 22:55
_AnsHUMAN_ 18-Jun-07 22:55 
GeneralRe: Wizard Style Dialogs Pin
Abhijeet Pathak18-Jun-07 23:06
Abhijeet Pathak18-Jun-07 23:06 
AnswerRe: Wizard Style Dialogs Pin
Iain Clarke, Warrior Programmer19-Jun-07 0:37
Iain Clarke, Warrior Programmer19-Jun-07 0:37 

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.