码迷,mamicode.com
首页 > 其他好文 > 详细

ActiveX显示图片

时间:2014-07-09 22:13:03      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   width   cti   

直接看代码:

// IPlayCtl
public:

    HRESULT OnDraw(ATL_DRAWINFO& di)
    {
        RECT& rc = *(RECT*)di.prcBounds;
        /*
        Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);

        SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
        LPCTSTR pszText = _T("ATL 3.0 : PlayCtl");
        TextOut(di.hdcDraw, 
            (rc.left + rc.right) / 2, 
            (rc.top + rc.bottom) / 2, 
            pszText, 
            lstrlen(pszText));
        */

        HDC hdc=di.hdcDraw;
        m_hBitmap= //(HBITMAP)LoadBitmap (NULL, "D:\\test.bmp") ;
             (HBITMAP)::LoadImage(NULL,"D:\\test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);  
        HDC hdcMem=CreateCompatibleDC(hdc);
        SelectObject(hdcMem, m_hBitmap);
        BitBlt(hdc,0,0,IMAGE_WIDTH,IMAGE_HEIGHT,hdcMem,0,0,SRCCOPY);
        DeleteDC(hdcMem);

        return S_OK;
    }
    OLE_COLOR m_clrFillColor;

    HBITMAP        m_hBitmap;
};

 

参考:

1,ATL窗口添加背景图片 

http://blog.163.com/l1_jun/blog/static/14386388201092521520392/

ActiveX显示图片,布布扣,bubuko.com

ActiveX显示图片

标签:style   blog   http   color   width   cti   

原文地址:http://www.cnblogs.com/tiancun/p/3829723.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!