Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

ATL control display image with Bitblt SRCAND not correct in word 2013

$
0
0

I created a ATL project with following code:

LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    const LONG_PTR exStyle = GetWindowLongPtr(GWL_EXSTYLE);
    SetWindowLongPtr(GWL_EXSTYLE, exStyle | WS_EX_TRANSPARENT);
    return 0;
}

HRESULT OnDrawAdvanced(ATL_DRAWINFO& di)
{
    RECT& rc = *(RECT*)di.prcBounds;

    CImage imgx;
    imgx.Load(_T("C:\\image.jpg"));
    imgx.StretchBlt(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom, 0,0,imgx.GetWidth(),imgx.GetHeight(), SRCAND);

    return S_OK;
}

this works in ms-word2007

in ms-word2013, when I changed the wrapping style to "In front of text",it displays a grayed image.

why is that? and how to fix this. Thanks very much.

you can check my original post on stackoverflow with images since I can not link images in this post.

https://stackoverflow.com/questions/51517939/atl-control-display-image-with-bitblt-srcand-not-correct-in-word-2013#comment90010156_51517939




Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>