请教,屏幕坐标像素twip(系统A接口函数要用)如何转换成像素(系统B接口函数要用)。如果我一个坐标是twip为单位(或者mm),如何转换为像素为单位,是不是和屏幕分辨率有关的。
int nXScreenMetrics = ::GetSystemMetrics(SM_CXSCREEN);
int nYScreenMetrics = ::GetSystemMetrics(SM_CYSCREEN);
GetDeviceCaps//
比如原来一个坐标点是(x,y),单位为twip或者mm的,调用上面函数后如何

解决方案 »

  1.   

    twip
    A screen-independent unit used to ensure that placement and proportion of screen elements in your screen application are the same on all display systems. A twip is a unit of screen measurement equal to 1/20 of a printer's point. There are approximately 1440 twips to a logical inch or 567 twips to a logical centimeter (the length of a screen item measuring one inch or one centimeter when printed).
      

  2.   

    // A twip (meaning "twentieth of a point") is the logical unit of measurement
    // used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720
    // twips equal 1/2 inch, while 32,768 twips is 22.75 inches.
      

  3.   

    如果我一个坐标是twip为单位,转换为像素为单位,是不是和屏幕分辨率有关的。
    //int nXScreenMetrics = ::GetSystemMetrics(SM_CXSCREEN);
    //int nYScreenMetrics = ::GetSystemMetrics(SM_CYSCREEN);
    int nXPIXPERINCH = GetDeviceCaps(::GetWindowDC(m_hWnd), LOGPIXELSX);
    int nYPIXPERINCH = GetDeviceCaps(::GetWindowDC(m_hWnd), LOGPIXELSY);fXCoord = x / 1440 * nXPIXPERINCH;这样转化后对不对,是不是转化前还需要调用clienttoscreen来转化下坐标。感觉这样都不对。不知道哪里错了