通过SetStretchMode(STRETCH_HALFTONE)实现,同时注意重新设置画刷起点

LRESULT CMainDlg::OnPaint(UINT uMsg, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) {
    CPaintDC dc(m_hWnd);
    CDC memDC;
    memDC.CreateCompatibleDC(dc);
    memDC.SelectBitmap((HBITMAP)m_cap_pic);
    dc.SetStretchBltMode(STRETCH_HALFTONE);
    ::SetBrushOrgEx(dc, 0, 0, NULL);
    dc.StretchBlt(m_rc_capture.left, m_rc_capture.top, m_rc_capture.Width(), 
        m_rc_capture.Height(), memDC, 0, 0, m_cap_pic.GetWidth(),
        m_cap_pic.GetHeight(), SRCCOPY);
    bHandled = FALSE;
    return 0;
}

 

相关文章:

  • 2021-08-15
  • 2022-12-23
  • 2021-10-31
  • 2021-06-28
  • 2021-06-17
  • 2022-01-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-15
  • 2021-11-20
  • 2022-12-23
  • 2021-04-01
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案