用MFC开发程序获取CTreeCtrl控件字体如下
CTreeCtrl treeCtrl;
CFont* Font = treeCtrl.GetFont();
LOGFONT lf;
Font->GetLogFont(&lf);然后根据获得的字体大小去设置CTreeCtrl的ItemHeight
遇到的问题是获得的lf.lfHeight 单位是point
而SetItemHeight是像素,这两者之间如何转换?LOGFONT structure
http://msdn.microsoft.com/en-us/library/dd145037(v=VS.85).aspx
CTreeCtrl treeCtrl;
CFont* Font = treeCtrl.GetFont();
LOGFONT lf;
Font->GetLogFont(&lf);然后根据获得的字体大小去设置CTreeCtrl的ItemHeight
遇到的问题是获得的lf.lfHeight 单位是point
而SetItemHeight是像素,这两者之间如何转换?LOGFONT structure
http://msdn.microsoft.com/en-us/library/dd145037(v=VS.85).aspx
1.http://stackoverflow.com/questions/2944149/converting-logfont-height-to-font-size-in-points2.http://msdn.microsoft.com/en-us/library/bb431779.aspx
"Because lf.lfHeight is an integer pixel height, it is subject to rounding differences that are introduced through the MulDiv call in different resolutions."