如何在对话框单位与象素单位间进行转换

参考 http://support.microsoft.com/kb/q145994/



pixelX = (dialogunitX * baseunitX) / 4

pixelY = (dialogunitY * baseunitY) / 8



void CAboutDlg::OnPaint()

{

CPaintDC dc(this); // device context for painting



CRect rc( 0, 0, 4, 8 );



MapDialogRect( &rc );

int baseUnitY = rc.bottom;

int baseUnitX = rc.right;

TRACE("baseUnitX = %d/n", baseUnitX);

TRACE("baseUnitY = %d/n", baseUnitY);

}

你可能感兴趣的:(如何在对话框单位与象素单位间进行转换)