Click here to Skip to main content
16,007,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: attaching my own menu bar?? Pin
pnpfriend12-Nov-02 8:33
pnpfriend12-Nov-02 8:33 
QuestionItem Selection Notification? Pin
Mash11-Nov-02 8:50
Mash11-Nov-02 8:50 
GeneralDialog Resize Pin
SavageBeast11-Nov-02 8:12
SavageBeast11-Nov-02 8:12 
GeneralRe: Dialog Resize Pin
Anonymous11-Nov-02 8:30
Anonymous11-Nov-02 8:30 
GeneralWorkspace name Pin
meirav11-Nov-02 8:06
meirav11-Nov-02 8:06 
GeneralRe: Workspace name Pin
SavageBeast11-Nov-02 8:14
SavageBeast11-Nov-02 8:14 
GeneralRe: Workspace name Pin
beetung11-Nov-02 8:24
beetung11-Nov-02 8:24 
GeneralCStatic center vert with wordbreak Pin
Dave_11-Nov-02 7:46
Dave_11-Nov-02 7:46 
I am trying to implement a CStatic control that has horizontally centered text with word break, and centered vertically as well. This control will be displaying multiple lines (as word break implies).
I tried getting the text extent by the following:

if (m_bCenterVert){<br />
CSize sz = pDCMem->GetTextExtent(strText);<br />
		TEXTMETRIC tm;<br />
		::ZeroMemory(&tm,sizeof(tm));<br />
		pDCMem->GetTextMetrics(&tm);<br />
		if (sz.cy <= tm.tmHeight){<br />
			int y = rc.CenterPoint().y;<br />
			y -= (tm.tmHeight / 2);<br />
			rc.OffsetRect(0,y - rc.top);<br />
		}<br />
	}<br />
	pDCMem->DrawText(strText,rc,dwFlags);


I think what is happening is the GetTextExtnent() is not showing the extent after the word breaking is done? It always adjusts to the center of the control, and the bottom line gets clipped.

Is there a better way?

Thanks.

(P.S.) How the heck do I indent my source code properly in one of these messages?
GeneralFarsi language in VC++ .NET Pin
Hadi Rezaee11-Nov-02 7:42
Hadi Rezaee11-Nov-02 7:42 
GeneralRe: Farsi language in VC++ .NET Pin
Mazdak12-Nov-02 4:35
Mazdak12-Nov-02 4:35 
GeneralRe: Farsi language in VC++ .NET Pin
Hadi Rezaee12-Nov-02 5:49
Hadi Rezaee12-Nov-02 5:49 
GeneralCopyImage woes Pin
Jim Crafton11-Nov-02 7:29
Jim Crafton11-Nov-02 7:29 
GeneralRe: CopyImage woes Pin
Christian Graus11-Nov-02 8:37
protectorChristian Graus11-Nov-02 8:37 
GeneralUse a Dialog to another pgm created by another pgm Pin
youssef11-Nov-02 7:00
youssef11-Nov-02 7:00 
GeneralRe: Use a Dialog to another pgm created by another pgm Pin
valikac11-Nov-02 7:48
valikac11-Nov-02 7:48 
GeneralRe: Use a Dialog to another pgm created by another pgm Pin
youssef12-Nov-02 13:37
youssef12-Nov-02 13:37 
GeneralChanging view Pin
act_x11-Nov-02 6:47
act_x11-Nov-02 6:47 
GeneralApplication Idle Timeout Pin
SchmoBoy11-Nov-02 6:27
SchmoBoy11-Nov-02 6:27 
GeneralRe: Application Idle Timeout Pin
valikac11-Nov-02 7:56
valikac11-Nov-02 7:56 
GeneralInvoking another Application Pin
act_x11-Nov-02 5:51
act_x11-Nov-02 5:51 
GeneralRe: Invoking another Application Pin
Chris Losinger11-Nov-02 5:56
professionalChris Losinger11-Nov-02 5:56 
GeneralRe: Invoking another Application Pin
Scott H. Settlemier11-Nov-02 5:56
Scott H. Settlemier11-Nov-02 5:56 
Generalserial comm. Pin
peter ho11-Nov-02 5:40
peter ho11-Nov-02 5:40 
GeneralRe: serial comm. Pin
Scott H. Settlemier11-Nov-02 5:51
Scott H. Settlemier11-Nov-02 5:51 
GeneralRotarty dial control knob Pin
john john mackey11-Nov-02 5:36
john john mackey11-Nov-02 5: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.