469,957 Members | 2,710 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,957 developers. It's quick & easy.

Invisible panel control events...

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
6 2965
<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
"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
<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
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
Thanks Michael. I didn't reallize there was an onpaint event just for
the panel.

Apr 18 '06 #6
<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.

Similar topics

2 posts views Thread by Alexander Brown | last post: by
6 posts views Thread by Selden McCabe | last post: by
1 post views Thread by Dino M. Buljubasic | last post: by
16 posts views Thread by Miguel Dias Moura | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.