C#, Focus change and re-paint query

N

Neville Lang

Hi all,

I have a TabControl with a number of TabPages. When one particular TabPage
is selected, a button on the ToolBar next to the menu becomes visible in my
app. When a user taps it, it raises a small window I created with a number
of buttons on it. That small window is instantiated in the normal way and I
then use xxx.Show() to display it. Meanwhile, the TabPage is still visible
to user in the background.

My problem is that if the user happens to tap anywhere on the TabPage in the
background, as expected, focus now moves to the TabPage via the TabControl
and the TabPage automatically re-paints. I have a situation where I do not
want the background TabPage to re-paint when that small window has been
activated. While I can intercept the OnGotFocus(), I cannot find a way to
prevent the TabPage from re-painting under these circumstances. Ideas
anyone?

Regards,
Neville Lang
 
N

Neville Lang

Dan,

Yes, that worked. When I changed the xxx.Show() to xxx.ShowDialog() it does
indeed prevent the user from tapping anywhere else and solves my problem.

When I used ShowDialog() a few days ago, I found that the background image
was not repainting so I went back to Show() and things worked after that so
I left it at that. I now find that on changing back to ShowDialog(), the
repainting of the image on the TabPage is now OK. On reflection, I guess
there was something else causing the previous problem and was not the
ShowDialog().

Thanks again.

Regards,
Neville Lang
 

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