OnPaint in TabPage

F

Freestyler

Here is the situation:
I've got the TabControl with some TabPages. The TabPages've got overriden
OnPaint() methods.
When I change the selected TabPage - the OnPaint method is executed.
Thats OK.
Now I've added an Overlayed Panel which covers TabPages partially.
When I click on the TabPage I'd like to have the Panel sent to back.
It is done in OnPaint() method but they are not executed even than I see
the TabPages switching after my click (the visible part of them)
I tried to override OnPaint, OnClick, OnGotFocus, OnRefresh methods on
TabPage, and OnPaint, OnClick, OnGotFocus, OnRefresh, OnMouseDown in
TabControl - NOTHING.
How can I solve the problem?

Thanks for any idea,
Freestyler
 
B

baramuse

Freestyler said:
Here is the situation:
I've got the TabControl with some TabPages. The TabPages've got overriden
OnPaint() methods.
When I change the selected TabPage - the OnPaint method is executed.
Thats OK.
Now I've added an Overlayed Panel which covers TabPages partially.
When I click on the TabPage I'd like to have the Panel sent to back.
It is done in OnPaint() method but they are not executed even than I see
the TabPages switching after my click (the visible part of them)
I tried to override OnPaint, OnClick, OnGotFocus, OnRefresh methods on
TabPage, and OnPaint, OnClick, OnGotFocus, OnRefresh, OnMouseDown in
TabControl - NOTHING.
How can I solve the problem?

Thanks for any idea,
Freestyler

ok i'm quite new in c# coding but i'll try to help you...
If I've understood correctly my lesson, the OnPaint event is raised only
if the control have to be redrawn. In your case, as the content of the
tabpage is not shown, it hasn't to be redrawn so the OnPaint event won't
be raised...
But as you change the selected tab anyway, you can catch the
SelectedIndexChanged event of the tabcontrol and then send the panel to
back...

I hope i don't tell you craps, and that it'll help you !!!
 
F

Freestyler

Uzytkownik "baramuse said:
ok i'm quite new in c# coding but i'll try to help you...
If I've understood correctly my lesson, the OnPaint event is raised only
if the control have to be redrawn. In your case, as the content of the
tabpage is not shown, it hasn't to be redrawn so the OnPaint event won't
be raised...
But as you change the selected tab anyway, you can catch the
SelectedIndexChanged event of the tabcontrol and then send the panel to
back...

I hope i don't tell you craps, and that it'll help you !!!

Thanks baramuse,
As the matter of fact you helped a lot.
Sadly it's the step forward, but not a solution.
I didn't try SelectedIndexChanged becouse when user clicks on the same
(open) TabPage no event is raised, and I definitely need one in that case
too.
But it works on deselected TabPages.
Does anybody know why Click event doesn't work?
Or there is sth like Aplication.OnClick() where I could find the place
clicked and do the action?

Regards,
Freestyler
 

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