Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Inform ActiveX about change of host's picture property?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2003, 03:55 PM
_Mark_ _Mark_ is offline
Newcomer
 
Join Date: Mar 2003
Posts: 24
Default 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.

Thank you for your help.

Mark
Reply With Quote
  #2  
Old 03-21-2003, 04:24 PM
AndreRyan AndreRyan is offline
Contributor
 
Join Date: Jan 2002
Posts: 489
Default

have you tried Me.Refresh
Reply With Quote
  #3  
Old 03-21-2003, 04:25 PM
Baz Baz is offline
Freshman
 
Join Date: Mar 2003
Location: Hampshire UK
Posts: 26
Default

Quote:
Originally Posted by _Mark_
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.

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.

<edit for clarity>
Reply With Quote
  #4  
Old 03-22-2003, 03:11 AM
_Mark_ _Mark_ is offline
Newcomer
 
Join Date: Mar 2003
Posts: 24
Default

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...

Is there a better way to do this?

Thank's!
Reply With Quote
  #5  
Old 03-22-2003, 03:37 AM
Banjo's Avatar
Banjo Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

You can setup your subclassing in the initialise event (make sure you don't do it if in design mode ) using the UserControl.Parent.hWnd value.
__________________
A wise one man once said "what you talking about dog breath"
Reply With Quote
  #6  
Old 03-22-2003, 06:13 AM
_Mark_ _Mark_ is offline
Newcomer
 
Join Date: Mar 2003
Posts: 24
Default

Thanks Banjo, problem resolved.

For the educational value of it: Do you know why GetParent(usercontrol.hwnd) fails whereas usercontrol.parent.hwnd works?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer private controls to another project.. Help! Jazler General 8 07-01-2002 09:59 AM
Open an associated Text Document knoxitis General 19 05-01-2002 11:26 PM
type mismatch in form load knoxitis General 32 04-26-2002 10:52 AM
data type mismatch in criteria expression knoxitis General 16 04-23-2002 09:15 AM

Advertisement:





Free Publications
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
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->