Bob
Thu Feb 02 12:37:45 CST 2006
There is no effective way to tell them apart. The transparency mechanism is
a bit of a pig in that respect.
The sender will be the form because the control just manipulates the
graphics object and tells the form to paint it's background...ergo it's
always the form that calls the method.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Jay Pondy" <jpondy@AugustaNewsprint.com> wrote in message
news:q972u1hvt3o6noo5a52paf3nb7oa12qheq@4ax.com...
> Thanks - that explains why the event is occurring so often - my
> controls DO have a transparent background.
>
> How can I tell the difference between when the Forms background paint
> is called and the controls? I've tried using "if type of sender is
> form" but it is always the Form.
>
> What is happening is that the transparent controls backgrounds are
> also being drawn with their own gradient background so I'm curious as
> to how to tell them apart.
>
>
>
> On Wed, 1 Feb 2006 19:12:28 +0100, "Bob Powell [MVP]"
> <bob@_spamkiller_.bobpowell.net> wrote:
>
>>It's possible the parent PaintBackground will be invoked for each control
>>if
>>you've made the controls transparent. Transparent controls actually use a
>>transform to offset the graphics to correspond with the window rectangle
>>of
>>the parent form and then call the parents draw routines directly...
>