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

C / C++ / MFC

 
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 
GeneralRe: static text box , GetClientRect, GetTextExtent [modified] Pin
Mark Salsbery16-May-07 8:24
Mark Salsbery16-May-07 8:24 
Here's an example - using the dialog's font...

void CmyAppDlg::OnBnClickedOk()
{
CRect stbRect;
CString cs2;
staticTextBox.GetClientRect(stbRect);
staticTextBox.GetWindowTextW(cs2);

// Get a DC for the static control
//*edit* this could be "CClientDC ClientDC(this);"
//*edit* (any window/screen-compatible DC will do)
CClientDC StaticDC(&staticTextBox);

// Select the dialog's font into it
CFont *pOldFont = StaticDC.SelectObject(GetFont());

// Get the text extent based on the dialog font
CSize textSize = StaticDC.GetTextExtent(cs2);

// restore the DC
StaticDC.SelectObject(pOldFont);

cs2.Format((_T("%d - %d")), textSize.cx, stbRect.Width());
AfxMessageBox(cs2,0,0);
}


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


-- modified at 14:29 Wednesday 16th May, 2007
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 
Questionwininet.h and winsock.h Pin
amitmistry_petlad 16-May-07 2:59
amitmistry_petlad 16-May-07 2:59 

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.