zoukankan      html  css  js  c++  java
  • 【MFC相关】图片显示

    CPaintDC dc(this); 
    
    if (!m_hBitmap) return;
    image.Attach(m_hBitmap);
    CRect rect;
    GetClientRect(&rect);//获得控件所在的矩形区域
    int width = rect.Width();
    int height = rect.Height();
    //......
    
    CDC mDC;
    mDC.CreateCompatibleDC(&dc);
    CBitmap b;
    b.CreateCompatibleBitmap(&dc, width, height);
    mDC.SelectObject(&b);
    mDC.SetStretchBltMode(HALFTONE);
    mDC.FillSolidRect(0, 0, width, height, RGB(212, 208, 200));//设置背景颜色
    image.StretchBlt(mDC.m_hDC, marginx, marginy, width-2*marginx, height-2*marginy);
    BitBlt(dc.m_hDC, 0, 0, width, height, mDC.m_hDC, 0, 0, SRCCOPY);
    mDC.DeleteDC();
    ::DeleteObject(&b);
    m_hBitmap = image.Detach();
  • 相关阅读:
    day89
    day88
    day87
    day86
    day85
    day84
    day83
    Maven仓库汇总
    [转载]AngularJS入门教程04:双向绑定
    [转载]AngularJS入门教程03:迭代器
  • 原文地址:https://www.cnblogs.com/imagezy/p/4569393.html
Copyright © 2011-2022 走看看