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

C / C++ / MFC

 
QuestionNeed a free image library, png, Visual Studio 6.0 Pin
Andrlage14-Mar-13 5:52
Andrlage14-Mar-13 5:52 
AnswerRe: Need a free image library, png, Visual Studio 6.0 Pin
Richard MacCutchan14-Mar-13 6:22
mveRichard MacCutchan14-Mar-13 6:22 
AnswerRe: Need a free image library, png, Visual Studio 6.0 Pin
_Flaviu14-Mar-13 21:19
_Flaviu14-Mar-13 21:19 
QuestionMSCOWRKS.DLL ? Pin
ForNow13-Mar-13 3:10
ForNow13-Mar-13 3:10 
AnswerRe: MSCOWRKS.DLL ? Pin
Richard MacCutchan13-Mar-13 3:53
mveRichard MacCutchan13-Mar-13 3:53 
GeneralRe: MSCOWRKS.DLL ? Pin
ForNow13-Mar-13 4:12
ForNow13-Mar-13 4:12 
AnswerRe: MSCOWRKS.DLL ? Pin
Albert Holguin13-Mar-13 5:33
professionalAlbert Holguin13-Mar-13 5:33 
QuestionHow to fix Static contol width at run time? Pin
Le@rner12-Mar-13 20:52
Le@rner12-Mar-13 20:52 
Hi all,

on dialog box i have a static contol i want to fit its width according to its text when dialog box is open or text change .

i use this but the control width is set less than text width..
C++
// get the text dimensions
	CString strText;
	m_label.GetWindowText(strText);
	CClientDC dc(this);
	CFont* pFont = GetFont();
	CFont* pOldFont = (CFont*)dc.SelectObject(pFont);
	CSize sizeText = dc.GetTextExtent(strText);
	dc.SelectObject(pOldFont);

	// get the text area (presume left-alligned text).
	CRect rcText;
	m_label.GetWindowRect(rcText);
	
	CRect dlg_stc=rcText;
	this->ScreenToClient(dlg_stc);
	
	rcText = dlg_stc;

	rcText.right = min(rcText.right, sizeText.cx);

	
	CRect new_rect=rcText;
	m_label.MoveWindow(new_rect);



can anybody help me to do this.

thanks.

modified 13-Mar-13 3:14am.

AnswerRe: How to fix Static contol width at run time? Pin
Richard MacCutchan12-Mar-13 22:22
mveRichard MacCutchan12-Mar-13 22:22 
GeneralRe: How to fix Static contol width at run time? Pin
Le@rner13-Mar-13 1:25
Le@rner13-Mar-13 1:25 
AnswerRe: How to fix Static contol width at run time? Pin
Parthi_Appu13-Mar-13 1:47
Parthi_Appu13-Mar-13 1:47 
GeneralRe: How to fix Static contol width at run time? Pin
Le@rner13-Mar-13 2:01
Le@rner13-Mar-13 2:01 
QuestionCannot access #include files – “permission denied” [modified] Pin
Member 990306512-Mar-13 0:42
Member 990306512-Mar-13 0:42 
AnswerRe: Cannot access #include files – “permission denied” [modified] Pin
Richard MacCutchan12-Mar-13 1:11
mveRichard MacCutchan12-Mar-13 1:11 
AnswerRe: Cannot access #include files – “permission denied” [modified] Pin
Orjan Westin12-Mar-13 1:13
professionalOrjan Westin12-Mar-13 1:13 
QuestionRe: Cannot access #include files – “permission denied” [modified] Pin
Richard MacCutchan12-Mar-13 2:18
mveRichard MacCutchan12-Mar-13 2:18 
QuestionBitmap creation from a buffer recived Pin
Member 990306512-Mar-13 0:26
Member 990306512-Mar-13 0:26 
AnswerRe: Bitmap creation from a buffer recived Pin
Richard MacCutchan12-Mar-13 1:13
mveRichard MacCutchan12-Mar-13 1:13 
Questionunable to register COM dll 64 bit Pin
Member 990306512-Mar-13 0:24
Member 990306512-Mar-13 0:24 
AnswerRe: unable to register COM dll 64 bit Pin
Richard MacCutchan12-Mar-13 1:15
mveRichard MacCutchan12-Mar-13 1:15 
AnswerRe: unable to register COM dll 64 bit Pin
dusty_dex12-Mar-13 5:16
dusty_dex12-Mar-13 5:16 
QuestionPlay Media File Pin
Member 990306512-Mar-13 0:23
Member 990306512-Mar-13 0:23 
AnswerRe: Play Media File Pin
Richard MacCutchan12-Mar-13 1:19
mveRichard MacCutchan12-Mar-13 1:19 
QuestionHow to find out if a file is loaded in memory? Pin
dliviu11-Mar-13 23:01
dliviu11-Mar-13 23:01 
AnswerRe: How to find out if a file is loaded in memory? Pin
CPallini11-Mar-13 23:27
mveCPallini11-Mar-13 23:27 

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.