How to make the ActiveX control full transparent int word
-
I want to write a ActiveX control for word, which has the transparent effect,which can't envelop the test in word document no matter what drawn in the control. But I don't know how to achieve the transparent effect. My English is poor. I hope you can follow me and can help me
-
I want to write a ActiveX control for word, which has the transparent effect,which can't envelop the test in word document no matter what drawn in the control. But I don't know how to achieve the transparent effect. My English is poor. I hope you can follow me and can help me
Ni Hao, To draw your control as transparent must Override the OnDraw() of the ActiveX. If you Do nothing there the control will never be written ad you should see what lies bellow it. Also you could use the function TransparentBlt() to draw any overlay you want. A third option could be capturing the screen below the control an drawing it (for avoiding the . HRESULT CCAxQuantMaster::OnDraw(ATL_DRAWINFO& di) { RECT& rc = *(RECT*)di.prcBounds; // Set Clip region to the rectangle specified by di.prcBounds HRGN hRgnOld = NULL; if (GetClipRgn(di.hdcDraw, hRgnOld) != 1) hRgnOld = NULL; bool bSelectOldRgn = false; HRGN hRgnNew = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom); if (hRgnNew != NULL) { bSelectOldRgn = (SelectClipRgn(di.hdcDraw, hRgnNew) != ERROR); } //Select Transparent Brush SelectObject(di.hdcDraw, GetStockObject(NULL_BRUSH)); Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom); }
JO :)
-
Ni Hao, To draw your control as transparent must Override the OnDraw() of the ActiveX. If you Do nothing there the control will never be written ad you should see what lies bellow it. Also you could use the function TransparentBlt() to draw any overlay you want. A third option could be capturing the screen below the control an drawing it (for avoiding the . HRESULT CCAxQuantMaster::OnDraw(ATL_DRAWINFO& di) { RECT& rc = *(RECT*)di.prcBounds; // Set Clip region to the rectangle specified by di.prcBounds HRGN hRgnOld = NULL; if (GetClipRgn(di.hdcDraw, hRgnOld) != 1) hRgnOld = NULL; bool bSelectOldRgn = false; HRGN hRgnNew = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom); if (hRgnNew != NULL) { bSelectOldRgn = (SelectClipRgn(di.hdcDraw, hRgnNew) != ERROR); } //Select Transparent Brush SelectObject(di.hdcDraw, GetStockObject(NULL_BRUSH)); Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom); }
JO :)