Outside of the client region!

  • Thread starter Thread starter mehdi
  • Start date Start date
M

mehdi

Hi folks,
Consider a visual component that's being derived from Control, say
MyCustomControl. This is opened-up whenever the user clicks a given
button in the toolbar. How am I supposed to open up this control
outside the ClientRectangle bounds?

Any help would be highly appreciated,

Cheers,
Mehdi
 
Hello mehdi,
Consider a visual component that's being derived from Control, say
MyCustomControl. This is opened-up whenever the user clicks a given
button in the toolbar. How am I supposed to open up this control
outside the ClientRectangle bounds?

Interesting way of phrasing that question... to be precise, I think you're
not supposed to do that at all.

Taking your question less literally, the reason why a simple Control
derived control will not be shown outside its parent container is because
it's not marked as being a top-level window. You could go and insert this
line in your control's constructor:

SetTopLevel(true);

Then you should be able to show the control outside any container - just
don't give it a Parent and call Show().

Of course there are certain drawbacks in this simple example - for
instance, the control will probably get a window border. It would depend
on your situation how you'd best proceed.


Oliver Sturm
 
Hello mehdi,


Interesting way of phrasing that question... to be precise, I think you're
not supposed to do that at all.

Taking your question less literally, the reason why a simple Control
derived control will not be shown outside its parent container is because
it's not marked as being a top-level window. You could go and insert this
line in your control's constructor:

SetTopLevel(true);

Then you should be able to show the control outside any container - just
don't give it a Parent and call Show().

Of course there are certain drawbacks in this simple example - for
instance, the control will probably get a window border. It would depend
on your situation how you'd best proceed.

Oliver Sturm
--http://www.sturmnet.org/blog

Well, would you please let me know how the menu bars are drawn outside
of the client region of a given program, without being a top-level
window??? Resize the notepad so that you can only see the menu bar.
Then click on "File" menu.... and you'll see that the menu will be
painted outside of the client region of the notepad. How this can be
possible?

Thank you for your time,
Mehdi
 
mehdi said:
Well, would you please let me know how the menu bars are drawn outside
of the client region of a given program, without being a top-level
window??? Resize the notepad so that you can only see the menu bar.
Then click on "File" menu.... and you'll see that the menu will be
painted outside of the client region of the notepad. How this can be
possible?

Because the menu is in fact a window with a special Window-Class.

Best regards,
Martin
 
Back
Top