zoukankan      html  css  js  c++  java
  • 设置对话框的背景颜色

    第一种方法,用图片控件piture Control ;

    但是这种方法不能刷新背景,如果程序被其他程序覆盖的话,切换回程序的话,背景图片会把程序的其他控件覆盖掉;

    第二种:

    在程序的OnPaint()函数里面用双缓冲进行贴图;

    if (IsIconic() )
    {
    
    CPaintDC dc(this); // device context for painting
    
    SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
    
    
    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;
    
    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
    
    }
    
    else
    {
    CPaintDC dc(this); CDC memdc; memdc.CreateCompatibleDC(&dc);//创建兼容DC CBitmap bkg; bkg.LoadBitmap( IDB_BITMAP_DIALOG);//载入位图 BITMAP bkginfo; bkg.GetBitmap(&bkginfo);//获取位图信息 memdc.SelectObject(&bkg); RECT rect; GetWindowRect(&rect);//获取对话框信息 dc.StretchBlt(0,0,rect.right-rect.left,rect.bottom-rect.top,&memdc,0,0,bkginfo.bmWidth,bkginfo.bmHeight,SRCCOPY); }
  • 相关阅读:
    音频处理入门笔记
    python对象-多态
    python对象的不同参数集合
    python多重继承的钻石问题
    python对象的多重继承
    python类继承的重写和super
    Python继承扩展内置类
    python对象继承
    Python模块与包
    Pyhton对象解释
  • 原文地址:https://www.cnblogs.com/chenzuoyou/p/3507561.html
Copyright © 2011-2022 走看看