U
uncleSally
* Note : I posted this message in the
microsoft.public.dotnet.framework.drawing forum, and Jeff Johnson
suggested I post it here, instead. I do think this is a more
appropriate forum, and I have deleted the post from the drawing forum.
I try and be very conscientous about never cross-posting.*
Hi,
Scenario :
1. Form1 : regular Windows Form. TopMost = false
2. Form2 : regular Windows Form with background color set to
TransparencyKey value so Form1 shows through where the background is
not covered by controls on it that have solid backgrounds and thus
appear opaque. TopMost = true
3. code in place in the Move event of Form2 to raise an Event to
Form1 that does the right thing to insure that moving Form2 outside
of Form1's client rectangle on the screen results in the position of
Form2 being moved back so it is within the bounds of Form1's client
rectangle.
I can do some nice things using independent forms which can have
their own TransparencyKeys set so the controls on them appear as
opaque with the form underneath showing through.
It's not that hard to write code that restrains the moving of these
independent forms to the current screen displayrect of the underlying
form, but :
As your code (that detects the moving topmost form is outside of the
underlying form) triggers to move the top form back into the
underlying form's client area, you can get some stutter/flicker
effects. If you drag fast, you can see the the dragged topmost form
outside the underlying form before it snaps back.
With resizing you've got begin and end resize events you can play
with, but in terms of a form being moved using by dragging the
titlebar : you've got the Move event and the LocationChanged event
(haven't looked at RegionChanged).
Wonder if there's any hack that can be used to intercept a Move event
on Form2 before it's actually moved.
I've played with over-riding 'OnMove, in Form2, and can certainly
test in that over-ride whether the top Form's location is contained
within the form beneath it, but haven't found a way to stop a move
from happening by, for example, omitting the call to Base.OnMove(e)
thanks, Bill
p.s. yes, have played with various WindowStyles, Double-buffering,
etc. to no avail.
microsoft.public.dotnet.framework.drawing forum, and Jeff Johnson
suggested I post it here, instead. I do think this is a more
appropriate forum, and I have deleted the post from the drawing forum.
I try and be very conscientous about never cross-posting.*
Hi,
Scenario :
1. Form1 : regular Windows Form. TopMost = false
2. Form2 : regular Windows Form with background color set to
TransparencyKey value so Form1 shows through where the background is
not covered by controls on it that have solid backgrounds and thus
appear opaque. TopMost = true
3. code in place in the Move event of Form2 to raise an Event to
Form1 that does the right thing to insure that moving Form2 outside
of Form1's client rectangle on the screen results in the position of
Form2 being moved back so it is within the bounds of Form1's client
rectangle.
I can do some nice things using independent forms which can have
their own TransparencyKeys set so the controls on them appear as
opaque with the form underneath showing through.
It's not that hard to write code that restrains the moving of these
independent forms to the current screen displayrect of the underlying
form, but :
As your code (that detects the moving topmost form is outside of the
underlying form) triggers to move the top form back into the
underlying form's client area, you can get some stutter/flicker
effects. If you drag fast, you can see the the dragged topmost form
outside the underlying form before it snaps back.
With resizing you've got begin and end resize events you can play
with, but in terms of a form being moved using by dragging the
titlebar : you've got the Move event and the LocationChanged event
(haven't looked at RegionChanged).
Wonder if there's any hack that can be used to intercept a Move event
on Form2 before it's actually moved.
I've played with over-riding 'OnMove, in Form2, and can certainly
test in that over-ride whether the top Form's location is contained
within the form beneath it, but haven't found a way to stop a move
from happening by, for example, omitting the call to Base.OnMove(e)
thanks, Bill
p.s. yes, have played with various WindowStyles, Double-buffering,
etc. to no avail.