Click here to Skip to main content
15,895,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GetTempPath(...) API help... Pin
Nilesh K.15-Jun-05 18:37
Nilesh K.15-Jun-05 18:37 
GeneralRe: GetTempPath(...) API help... Pin
RYU^^15-Jun-05 19:02
RYU^^15-Jun-05 19:02 
GeneralRe: GetTempPath(...) API help... Pin
Nilesh K.15-Jun-05 19:07
Nilesh K.15-Jun-05 19:07 
GeneralRe: GetTempPath(...) API help... Pin
David Crow16-Jun-05 3:59
David Crow16-Jun-05 3:59 
GeneralMAC address Pin
ask_you15-Jun-05 18:05
ask_you15-Jun-05 18:05 
GeneralRe: MAC address Pin
Nilesh K.15-Jun-05 18:44
Nilesh K.15-Jun-05 18:44 
GeneralRe: MAC address Pin
geo_m15-Jun-05 18:48
geo_m15-Jun-05 18:48 
GeneralDrawText Function problem Pin
Sudhir Mangla15-Jun-05 17:53
professionalSudhir Mangla15-Jun-05 17:53 
Dear All,

I have a problem with DrawText window sdk ApI.
I calcuale rectangle by DT_CalcRect flag and draw text, but text doesnot align to top of rectangle.
I have subtracted extenalleading fatctor from the top of rectangle, still it doesnot align to top of retangle.
There is small gap betwenn text and top of rectangle.

CString stHeaderCenter = _T("ABC");
CRectr rtDraw(0, 0, 0, 0);
// Calculate required rectangle area
DrawText(hdc, stHeaderCenter, stHeaderCenter.GetLength(), &rtDraw,
DT_CALCRECT | DT_EDITCONTROL );

int nRtWidth = rtDraw.Width();

int nRtHeight = rtDraw.Height();



TEXTMETRIC tm;

ZeroMemory(&tm, sizeof(tm));
GetTextMetrics(hdc, &tm);

LONG lextLeading = tm.tmExternalLeading ;

// Subtract extenal leading factor

rtDraw.top = rtDraw.top - lextLeading ; // show the text on top in bounding rectangle

rtDraw.right = rtDraw.left + nRtWidth;

rtDraw.bottom = rtDraw.top + nRtHeight;



// Main header center

DrawText(hdc, stHeaderCenter, stHeaderCenter.GetLength(), &rtDraw,

DT_EDITCONTROL | DT_EXPANDTABS | DT_TOP);

/**********************************************************/

Can anyone help me in solving the issue or any other approach that i should try to solve this probelem



Sudhir Mangla

http://Programmerworld.net

(Free books , articles , Source Code and Programming Tools and Utilities)
GeneralRe: DrawText Function problem Pin
User 58385216-Jun-05 2:19
User 58385216-Jun-05 2:19 
GeneralIcon on TabCtrl Pin
LiYS15-Jun-05 17:45
LiYS15-Jun-05 17:45 
GeneralMFC app failure to boot up in Windows XP Pin
D_code_writer15-Jun-05 17:26
D_code_writer15-Jun-05 17:26 
GeneralRe: MFC app failure to boot up in Windows XP Pin
Blake Miller16-Jun-05 5:26
Blake Miller16-Jun-05 5:26 
GeneralShow WS_CHILD Dialog as modal dialog (popup) Pin
AnTri15-Jun-05 12:50
AnTri15-Jun-05 12:50 
GeneralMFC Overview Pin
E Dyot15-Jun-05 9:52
E Dyot15-Jun-05 9:52 
GeneralRe: MFC Overview Pin
David Crow15-Jun-05 10:17
David Crow15-Jun-05 10:17 
GeneralRe: MFC Overview Pin
PJ Arends15-Jun-05 10:30
professionalPJ Arends15-Jun-05 10:30 
GeneralRe: MFC Overview Pin
E Dyot15-Jun-05 13:17
E Dyot15-Jun-05 13:17 
GeneralRe: MFC Overview Pin
Jack Puppy15-Jun-05 19:10
Jack Puppy15-Jun-05 19:10 
Generallanguage of error message Pin
NGS 54967215-Jun-05 9:48
NGS 54967215-Jun-05 9:48 
GeneralRe: language of error message Pin
David Crow15-Jun-05 10:13
David Crow15-Jun-05 10:13 
GeneralRe: language of error message Pin
NGS 54967217-Jun-05 5:51
NGS 54967217-Jun-05 5:51 
Generalmulti-language - HELP!!!! Pin
lynchspawn15-Jun-05 8:17
lynchspawn15-Jun-05 8:17 
GeneralRe: multi-language - HELP!!!! Pin
Maximilien15-Jun-05 9:02
Maximilien15-Jun-05 9:02 
GeneralRe: multi-language - HELP!!!! Pin
grigsoft15-Jun-05 9:10
grigsoft15-Jun-05 9:10 
GeneralRe: multi-language - HELP!!!! Pin
Alexander M.,15-Jun-05 9:26
Alexander M.,15-Jun-05 9:26 

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.