If I use the DC of my CTreeCtrl-derived class to calculate the horizontal extent of a tree item I would like to insert:
... it seems I cannot depend on this function while appending characters to the string (dString)in order to make all tree items the same length (within a pixel or two). In other words, I can do:
If I 'extend' each string in this fashion, they indeed have a final text extent (length) within a few pixels, but when they are displayed in the CTreeCtrl, they are all of different length.
It is as if the DC of the CTreeCtlr does not match the actual DC. Any ideas?
Thx
Code:
CDC *pDC = GetDC(); CSize nameSize = pDC->GetTextExtent (*dString);
Code:
while (nameSize.cx < someLimit) { dString->Append ("-"); nameSize = pDC->GetTextExtent (*dString); }
It is as if the DC of the CTreeCtlr does not match the actual DC. Any ideas?
Thx