Inform ActiveX about change of host's picture property?
Hi,
Is there a way to inform an ActiveX control of a change of its container's picture property (assuming the container supports that property)?
I am using the container's background color and background picture to achieve a transparency effect for my control. Using the AmbientProperties object I can respond to changes of the backcolor property of the container and adjust the DrawItem procedure for my control.
The AmbientProperties-Object doesn't include a picture property. I suppose I could subclass the host and redraw my control whenever the container receives a WM_ERASEBKGND message. That seems to be a bit expensive though.
Is there a way to inform an ActiveX control of a change of its container's picture property (assuming the container supports that property)?
I am using the container's background color and background picture to achieve a transparency effect for my control. Using the AmbientProperties object I can respond to changes of the backcolor property of the container and adjust the DrawItem procedure for my control.
The AmbientProperties-Object doesn't include a picture property. I suppose I could subclass the host and redraw my control whenever the container receives a WM_ERASEBKGND message. That seems to be a bit expensive though.
Thank you for your help.
Mark
I reckon you should use the repaint event in the container if supported (if not then you must subclass to get a handle to the event) and each time the event is fired examine the picture property for a change, if changed the inform your activex control.
Or ... If you dont want to have any code in the Client as I think you do, I think you must subclass messages to the parent window.
AndreRyan: I can't see what you are hinting at. Try me.refresh where?
Baz:
Thanks for your suggestion. That should work.
I can't obtain a valid handle to the parent window [ ... GetParent(usercontrol.hwnd) ... ] in the ReadProperties-Event of my usercontrol though - only when I initiate the subclassing of the parent in the Show-Event of the control, I will get a proper handle. ReadProperties happens before the Load-Event of the parent form, which I guess is the reason that at that time I can't get a handle to the parent window.
I am not fond of initiating the subclassing in the Show-Event of the control, since this event also fires every time the visibility of the control is set from false to true - therefore making it necessary to check whether the parent is already subclassed and so on...
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET. subscribe