共用方式為


TOUCH_COORD_TO_PIXEL巨集 (winuser.h)

將觸控座標轉換成圖元。

語法

long TOUCH_COORD_TO_PIXEL(
    long l
);

參數

l

要從觸控座標轉換成圖元的值。

返回值

類型: long

以像素為單位的座標值。

備註

TOUCH_COORD_TO_PIXEL巨集可用來將觸控座標(目前 centipixels)轉換成圖元。 觸控座標的粒度比圖元更精細,讓應用程式開發人員可以使用子圖元粒度進行圖形設計等特殊應用程式。

範例

case WM_TOUCH:        
  cInputs = LOWORD(wParam);
  pInputs = new TOUCHINPUT[cInputs];
  if (pInputs){
    if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))){
      for (int i=0; i < static_cast<INT>(cInputs); i++){
        TOUCHINPUT ti = pInputs[i];
        index = GetContactIndex(ti.dwID);
        if (ti.dwID != 0 && index < MAXPOINTS){                            
          // Do something with your touch input handle
          ptInput.x = TOUCH_COORD_TO_PIXEL(ti.x);
          ptInput.y = TOUCH_COORD_TO_PIXEL(ti.y);
          ScreenToClient(hWnd, &ptInput);
          
          if (ti.dwFlags & TOUCHEVENTF_UP){                      
            points[index][0] = -1;
            points[index][1] = -1;                
          }else{
            points[index][0] = ptInput.x;
            points[index][1] = ptInput.y;                
          }
        }
      }
    }
    // If you handled the message and don't want anything else done with it, you can close it
    CloseTouchInputHandle((HTOUCHINPUT)lParam);
    delete [] pInputs;
  }else{
    // Handle the error here 
  }  

需求

要求 價值觀
最低支援的用戶端 Windows 7 [僅限桌面應用程式]
支援的最低伺服器 Windows Server 2008 R2 [僅限桌面應用程式]
目標平臺 窗戶
頁首 winuser.h (包括 Windows.h)

另請參閱

巨集