0
Answer

Selection rectangle explorer like in a form

Yves

Yves

16y
2.8k
1
Hi,

I'm trying to do something that I thought simple, but it isn't obviously very simple. I would like to draw a rubber band (explorer like), to select some items in a window form.

I've a panel which content some children panels. First of all, I would like to get the events OnMouseEnter, OnMouseLeave, OnMouseMove, OnMouseUp and OnMouseDown in all my parent panel. When my mouse is over a child panel, these events didn't fire. I've tried to use IMessageFilter, but I think it's not the best solution, isn't it?

After that I tried to paint a semi-transparent panel representing my selection area. I didn't find how to draw something above my other controls.

My last idea was to capture my selection area in a bitmap. Then, I can draw my rectangle in that bitmap and draw the bitmap in the main window. However, I didn't find how to copy a zone of my form in a bitmap.

Does somebody has any idea?

Thanks,

Yves