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

C / C++ / MFC

 
QuestionCatching Key Event of an Edit Box Pin
ajitatif angajetor16-May-07 3:49
ajitatif angajetor16-May-07 3:49 
AnswerRe: Catching Key Event of an Edit Box Pin
led mike16-May-07 5:13
led mike16-May-07 5:13 
GeneralRe: Catching Key Event of an Edit Box Pin
ajitatif angajetor16-May-07 6:34
ajitatif angajetor16-May-07 6:34 
GeneralRe: Catching Key Event of an Edit Box Pin
malaugh16-May-07 8:58
malaugh16-May-07 8:58 
Questionstatic text box , GetClientRect, GetTextExtent [modified] Pin
daveyerwin16-May-07 3:34
daveyerwin16-May-07 3:34 
AnswerRe: static text box , GetClientRect, GetTextExtent Pin
shivditya16-May-07 4:55
shivditya16-May-07 4:55 
AnswerRe: static text box , GetClientRect, GetTextExtent Pin
Mark Salsbery16-May-07 5:21
Mark Salsbery16-May-07 5:21 
GeneralRe: static text box , GetClientRect, GetTextExtent Pin
daveyerwin16-May-07 7:50
daveyerwin16-May-07 7:50 
>> staticTextBox.GetDC() is returning a DC for the control but you've selected no font into it

Greetings Mark
I now have this ...

void CmyAppDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
//OnOK();
CRect stbRect;
CString cs2;
staticTextBox.GetClientRect(stbRect);
staticTextBox.GetWindowTextW(cs2);
CFont * font = GetDC()->GetCurrentFont();
staticTextBox.SetFont(font,1);
CSize textSize = staticTextBox.GetDC()->GetTextExtent(cs2);
cs2.Format((_T("%d - %d")), textSize.cx, stbRect.Width());
AfxMessageBox(cs2,0,0);
}
Now when the text fills the width of the
static control textSize.cx equals stbRect.Width().
This is a good thing .
I am setting the font of the control to the
same font used by GetTextExtent .
How may I instead , set the font used by
GetTextExtent to the same font used by
the static control ?
Thanks for reading this .
GeneralRe: static text box , GetClientRect, GetTextExtent [modified] Pin
Mark Salsbery16-May-07 8:24
Mark Salsbery16-May-07 8:24 
GeneralRe: static text box , GetClientRect, GetTextExtent Pin
daveyerwin16-May-07 14:13
daveyerwin16-May-07 14:13 
GeneralRe: static text box , GetClientRect, GetTextExtent Pin
Mark Salsbery16-May-07 14:26
Mark Salsbery16-May-07 14:26 
QuestionRe: static text box , GetClientRect, GetTextExtent Pin
Hamid_RT16-May-07 5:25
Hamid_RT16-May-07 5:25 
Questionenum Pin
klutez12316-May-07 3:09
klutez12316-May-07 3:09 
AnswerRe: enum Pin
David Crow16-May-07 3:15
David Crow16-May-07 3:15 
GeneralRe: enum Pin
klutez12316-May-07 3:18
klutez12316-May-07 3:18 
GeneralRe: enum Pin
Maximilien16-May-07 3:38
Maximilien16-May-07 3:38 
Questionhow to build a 3-dimension image processing ? Pin
gentleguy16-May-07 3:02
gentleguy16-May-07 3:02 
AnswerRe: how to build a 3-dimension image processing ? Pin
Cedric Moonen16-May-07 3:29
Cedric Moonen16-May-07 3:29 
AnswerRe: how to build a 3-dimension image processing ? Pin
Hamid_RT16-May-07 5:40
Hamid_RT16-May-07 5:40 
QuestionSave an image (of 24 bits depth or less) Pin
llp00na16-May-07 3:00
llp00na16-May-07 3:00 
AnswerRe: Save an image (of 24 bits depth or less) Pin
Mark Salsbery16-May-07 5:27
Mark Salsbery16-May-07 5:27 
GeneralRe: Save an image (of 24 bits depth or less) Pin
llp00na16-May-07 6:21
llp00na16-May-07 6:21 
GeneralRe: Save an image (of 24 bits depth or less) Pin
Mark Salsbery16-May-07 6:31
Mark Salsbery16-May-07 6:31 
GeneralRe: Save an image (of 24 bits depth or less) Pin
llp00na16-May-07 6:42
llp00na16-May-07 6:42 
GeneralRe: Save an image (of 24 bits depth or less) Pin
Nelek17-May-07 20:04
protectorNelek17-May-07 20:04 

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.