By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Invisible panel control events...

P: n/a
How do I make a panel control invisible, but still recieve events?

I have a panel that I set visible= false, and over it I am using GDI+
to paint a grid of rectangles. It has to be invisble or else it covers
up the GDI+. However, it is not firing the mousedown and up events
while it is not visible. I am setting the visible property using VS
through the properties window.

I kind of anticipated that an invisble control would still recieve the
click events, but I guessed wrong. I'm not sure how to proceed on
this. Maybe if there is a way to set the control to 100% transparent?

Apr 17 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
<sh******@cs.fsu.edu> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
How do I make a panel control invisible, but still recieve events?

I have a panel that I set visible= false, and over it I am using GDI+
to paint a grid of rectangles. It has to be invisble or else it covers
up the GDI+. However, it is not firing the mousedown and up events
while it is not visible. I am setting the visible property using VS
through the properties window.

I kind of anticipated that an invisble control would still recieve the
click events, but I guessed wrong. I'm not sure how to proceed on
this. Maybe if there is a way to set the control to 100% transparent?


You can't. Just make the panel visible and make it the same size as what you
are painting and then paint onto the panel only. If you need mouse movements
for a subsection of your painting then do that in code.

Michael
Apr 18 '06 #2

P: n/a
"paint onto the panel only"

I don't guess I understand that part...
When I paint my rectangles with GDI+ they don't show up if the panel is
visible. It's like the panel is getting painted after my GDI+ does
when the onpaint event is fired.

Thanks for your help.

Apr 18 '06 #3

P: n/a
<sh******@cs.fsu.edu> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...
"paint onto the panel only"

I don't guess I understand that part...
When I paint my rectangles with GDI+ they don't show up if the panel is
visible. It's like the panel is getting painted after my GDI+ does
when the onpaint event is fired.


The form will have the WS_CLIPCHILDREN style which will mean that any
painting to the form will not paint over any of the controls. It's not that
the panel paints over it, it's that painting never occurs over the panel to
start with. What you should be doing is painting to the panel, not the form.
You can use the panel's paint event instead of the forms OnPaint override,
or if you want to use the panel's OnPaint override you'll need to inherit
it.

Michael
Apr 18 '06 #4

P: n/a
Michael C,

What is more simple than hittesting against a pixel (point)? Just compare
the mouse coordinates with the point location . For better user experiance
you can add some interval around the point.
--

Stoitcho Goutsev (100)

"Michael C" <no****@nospam.com> wrote in message
news:eb**************@TK2MSFTNGP02.phx.gbl...
<sh******@cs.fsu.edu> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...
"paint onto the panel only"

I don't guess I understand that part...
When I paint my rectangles with GDI+ they don't show up if the panel is
visible. It's like the panel is getting painted after my GDI+ does
when the onpaint event is fired.


The form will have the WS_CLIPCHILDREN style which will mean that any
painting to the form will not paint over any of the controls. It's not
that the panel paints over it, it's that painting never occurs over the
panel to start with. What you should be doing is painting to the panel,
not the form. You can use the panel's paint event instead of the forms
OnPaint override, or if you want to use the panel's OnPaint override
you'll need to inherit it.

Michael

Apr 18 '06 #5

P: n/a
Thanks Michael. I didn't reallize there was an onpaint event just for
the panel.

Apr 18 '06 #6

P: n/a
<sh******@cs.fsu.edu> wrote in message
news:11**********************@z34g2000cwc.googlegr oups.com...
Thanks Michael. I didn't reallize there was an onpaint event just for
the panel.


OnPaint comes from Control which all controls and forms inherit from.

Michael
Apr 18 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.