• 为MFC按钮添加各种图片


    一般放在重绘函数OnPaint()里

     OnPaint()

    {

           //为按钮添加图片

            Image image(L"...resSH\退出系统正常状态.png",TRUE);
            Graphics graphics(m_button16.GetWindowDC()->m_hDC);
            graphics.DrawImage(&image,0,0,image.GetWidth(),image.GetHeight());

             //为窗体添机背景图片

             CPaintDC dc(this); // device context for painting

             CRect rect;

             GetClientRect(&rect);
             Graphics graphics(dc.m_hDC);
             //加载PNG图片
             Bitmap background(L".\userlist\classlist_top.png");
             graphics.DrawImage(&background,0,0,rect.Width(),rect.Height());
             CDialog::OnPaint();

    }

  • 相关阅读:
    ADO.NET存取数据库数据
    2017-01-03
    re模块
    random模块(随机)
    sys模块
    os模块
    datetime模块
    time模块
    logging模块
    Python函数初识
  • 原文地址:https://www.cnblogs.com/zys871841072/p/3219299.html
Copyright © 2020-2023  润新知