Click here to Skip to main content
15,886,716 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionQuestion for Static control with Notify property. Pin
Le@rner16-Jan-11 22:43
Le@rner16-Jan-11 22:43 
AnswerRe: Question for Static control with Notify property. Pin
Niklas L16-Jan-11 22:50
Niklas L16-Jan-11 22:50 
GeneralRe: Question for Static control with Notify property. Pin
Le@rner16-Jan-11 23:10
Le@rner16-Jan-11 23:10 
GeneralRe: Question for Static control with Notify property. Pin
Andrew Brock16-Jan-11 23:23
Andrew Brock16-Jan-11 23:23 
GeneralRe: Question for Static control with Notify property. Pin
Le@rner16-Jan-11 23:30
Le@rner16-Jan-11 23:30 
GeneralRe: Question for Static control with Notify property. Pin
Andrew Brock16-Jan-11 23:34
Andrew Brock16-Jan-11 23:34 
GeneralRe: Question for Static control with Notify property. Pin
Le@rner16-Jan-11 23:40
Le@rner16-Jan-11 23:40 
GeneralRe: Question for Static control with Notify property. Pin
Andrew Brock17-Jan-11 0:10
Andrew Brock17-Jan-11 0:10 
Sorry, I forgot to say that you need to select the font:
CWnd *pStatic = GetDlgItem(IDC_STATIC_1);
CDC *pDC = GetDC();
CString text;
pStatic->GetWindowText(text);
CFont *pOldFont = pDC->SelectObject(pStatic->GetFont());
CSize szText = pDC->GetTextExtent(text);
pDC->SelectObject(pOldFont);
ReleaseDC(pDC);
pStatic->SetWindowPos(this, 0, 0, csText.cx, csText.cy, SWP_NOMOVE);


There is another way of doing this rather than in the OnInitDialog, still using GetTextExtent.
You can check if the mouse is inside the text rect in the event (OnClick or OnMouseMove), but this requires more code
GeneralRe: Question for Static control with Notify property. Pin
Le@rner17-Jan-11 0:39
Le@rner17-Jan-11 0:39 
GeneralRe: Question for Static control with Notify property. Pin
Andrew Brock17-Jan-11 0:40
Andrew Brock17-Jan-11 0:40 
QuestionAccelerators, MFC -> ATL [solved] Pin
Niklas L16-Jan-11 22:25
Niklas L16-Jan-11 22:25 
QuestionC++ compiler needed plzzzz Pin
aesthetic.crazy16-Jan-11 9:54
aesthetic.crazy16-Jan-11 9:54 
AnswerRe: C++ compiler needed plzzzz PinPopular
Manfred Rudolf Bihy16-Jan-11 10:04
professionalManfred Rudolf Bihy16-Jan-11 10:04 
AnswerRe: C++ compiler needed plzzzz Pin
Maximilien16-Jan-11 14:51
Maximilien16-Jan-11 14:51 
AnswerRe: C++ compiler needed plzzzz Pin
Richard MacCutchan17-Jan-11 0:33
mveRichard MacCutchan17-Jan-11 0:33 
AnswerRe: C++ compiler needed plzzzz Pin
Asit Banerjee18-Jan-11 21:42
Asit Banerjee18-Jan-11 21:42 
QuestionADO in MFC.....getting problems Pin
AmbiguousName16-Jan-11 3:57
AmbiguousName16-Jan-11 3:57 
AnswerRe: ADO in MFC.....getting problems Pin
User 742933816-Jan-11 4:24
professionalUser 742933816-Jan-11 4:24 
AnswerRe: ADO in MFC.....getting problems Pin
AmbiguousName16-Jan-11 4:30
AmbiguousName16-Jan-11 4:30 
AnswerRe: ADO in MFC.....getting problems Pin
PJ Arends16-Jan-11 11:55
professionalPJ Arends16-Jan-11 11:55 
Questionoperator ":" new for me in C++ Pin
aesthetic.crazy16-Jan-11 0:53
aesthetic.crazy16-Jan-11 0:53 
AnswerRe: operator ":" new for me in C++ Pin
Richard MacCutchan16-Jan-11 1:28
mveRichard MacCutchan16-Jan-11 1:28 
GeneralRe: operator ":" new for me in C++ Pin
aesthetic.crazy16-Jan-11 6:51
aesthetic.crazy16-Jan-11 6:51 
GeneralRe: operator ":" new for me in C++ Pin
Richard MacCutchan16-Jan-11 7:04
mveRichard MacCutchan16-Jan-11 7:04 
AnswerRe: operator ":" new for me in C++ PinPopular
Iain Clarke, Warrior Programmer16-Jan-11 1:36
Iain Clarke, Warrior Programmer16-Jan-11 1:36 

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.