CreateRectRgn

 

  hdc = BeginPaint(hWnd, &ps);
  
  RECT rtClient;
  ::GetClientRect(hWnd, &rtClient);
 

  // 创建一个绘制的区域(也就是说对此hdc的任何绘制, 只有从(0, 0)到(40, 40)的范围内有效)
  HRGN hrgn = ::CreateRectRgn(0, 0, 40, 40);
  ::SelectClipRgn(hdc, hrgn);

  ::MoveToEx(hdc, 0, 0, NULL);
  ::LineTo(hdc, rtClient.right, rtClient.bottom);

  EndPaint(hWnd, &ps);

你可能感兴趣的:(CreateRectRgn)