Detect the change on a control's parent painting?

Ö

Özden Irmak

Hello,

I want to detect when my control's parent redraws itself. I know that this
will cause a repaint in my control but I want to detect this before a paint
event occurs in my control...

Does anybody know if any event is fired in my control (before paint event)
for this purpose? Maybe OnLayout?

Regards,

Özden Irmak
 
B

Bob Powell [MVP]

Ö

Özden Irmak

Hi,

I'm sorry, I know that I cross posted but I thought that this question was
partly related with all those groups. Please advice me which one is suitable
and I'll just post to that group.

Thanks,

Özden Irmak
 
B

Bob Powell [MVP]

This one's good enough.

There is no pre-paint event as-such. Your controls should be in a state to
completely paint themselves at all times when a WM_PAINT message comes
along.

I guess the real question is why do you think you need such a structure?
Explain that and you'll probably get an answer that will correct a fault in
the architecture rather than add a kludge to the painting system.

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

Özden Irmak

Ok...

What I'm trying to achieve is to avoid unnecessary paintings in my
control...You might remember my elder post about transparent background and
this is exactly related with that...

Whenever a paint event occurs in my control (It is a container control, so
even a move on a contained control might cause the repaint) , I have to get
the parent background and paint it to my control surface again...To fasten
things, I want to cache the Parent background unless there is a change on
parent background and draw it to my control surface...

The cached bitmap refresh should occur (If I'm not wrong) if my control
changes it's size, location, parent or at last if something changes in it's
parent drawing. I can easily catch the first 3 events but stuck with the
fourth one. This is my problem...

By the way, another small question, can you point me a resource about
minimal/efficient GDI+ drawing? I saw that in your FAQ you wrote about font
catching, thanks for that, but I also would like to investigate suggestions
on other areas?

Regards,

Özden Irmak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top