henry3
asked on
GetTextExtent( ) returns inaccurate pixels
If you try the code, you'll find it.
extentName=pCDC->GetTextEx tent(LongN ame,strlen (LongName) );
if(strlen(LongName)>30){
m_listCtrl.SetHorizontalEx tent(exten tName.cx);
}
Note:30 is the characters listbox can hold.
The more long string is, the more obvious inaccuracy is.
Any idea?
extentName=pCDC->GetTextEx
if(strlen(LongName)>30){
m_listCtrl.SetHorizontalEx
}
Note:30 is the characters listbox can hold.
The more long string is, the more obvious inaccuracy is.
Any idea?
Hi!
Try sync DC ascyberfranc said and also try DrawText with DT_CALCRECT param
Try sync DC ascyberfranc said and also try DrawText with DT_CALCRECT param
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Everybody, and Happy New Year!
The main problem is, that fonts can be different in CDC (through the pCDC pointer) and in the listbox.
Try to synchronize fonts and the problem will be solved.
Or You can try:
CListBox::SetColumnWidth(i
Also, maybe you have problem with scrollbar himself. Try to set scroll range. Use the CListBox's
void SetScrollRange( int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE );
function where the nBar is:
SB_HORZ
CF