I am drawing in a picturebox on a form using
DrawReversibleFrame and DrawReversibleLine. It used to
draw fine on the picturebox, now all of a sudden it does
not appear on my form or application, but on VS.NET behind
my application. Has anyone seen this behaviour, and/or is
there any form/app settings that would affect this? Thanks.

Re: DrawReversibleFrame draws on VS.Net not my form by Bob

Bob
Fri Oct 24 03:26:24 CDT 2003

DrawReversibleFrame draws on the desktop, not on any specific window so if
something you're doing, such as animation with a timer, is refreshing the
form, it will appear as though the frame is behind your window.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

"Raul Escobar" <anonymous@discussions.microsoft.com> wrote in message
news:05a701c399e6$78eb7310$a501280a@phx.gbl...
> I am drawing in a picturebox on a form using
> DrawReversibleFrame and DrawReversibleLine. It used to
> draw fine on the picturebox, now all of a sudden it does
> not appear on my form or application, but on VS.NET behind
> my application. Has anyone seen this behaviour, and/or is
> there any form/app settings that would affect this? Thanks.



Re: DrawReversibleFrame draws on VS.Net not my form by Raul

Raul
Fri Oct 24 12:27:31 CDT 2003

Thanks for the answer. I do not have any such code, as far
as I know, but is there a form setting in either an MDI
parent or child form that might cuase this? At one point,
I had placed an image on the background of my mdiParent,
but removed it, because the redraw was too slow. Is there
some setting that might have been changed that might cause
rhis type of thing? I've verified that a new project works
fine, but adding test pictureboxes in my MDI application
doesn't work. Thanks alot!

>-----Original Message-----
>DrawReversibleFrame draws on the desktop, not on any
specific window so if
>something you're doing, such as animation with a timer,
is refreshing the
>form, it will appear as though the frame is behind your
window.
>
>--
>Bob Powell [MVP]
>C#, System.Drawing
>
>The October edition of Well Formed is now available.
>Find out how to use DirectX in a Windows Forms control
>http://www.bobpowell.net/currentissue.htm
>
>Answer those GDI+ questions with the GDI+ FAQ
>http://www.bobpowell.net/gdiplus_faq.htm
>
>Blog http://bobpowelldotnet.blogspot.com
>
>"Raul Escobar" <anonymous@discussions.microsoft.com>
wrote in message
>news:05a701c399e6$78eb7310$a501280a@phx.gbl...
>> I am drawing in a picturebox on a form using
>> DrawReversibleFrame and DrawReversibleLine. It used to
>> draw fine on the picturebox, now all of a sudden it does
>> not appear on my form or application, but on VS.NET
behind
>> my application. Has anyone seen this behaviour, and/or
is
>> there any form/app settings that would affect this?
Thanks.
>
>
>.
>

Re: DrawReversibleFrame draws on VS.Net not my form by Jay

Jay
Fri Oct 24 12:56:26 CDT 2003

Raul,
As Bob stated, DrawReversibleFrame draws on the desktop, in other words you
pass it screen coordinates to do the drawing.

If you are passing it Client coordinates and your window is not in the upper
left corner of your monitor, then YES it will draw on VS.NET, assuming that
VS.NET is behind your app and you have VS.NET maximized.

One way to fix this is to move your app window to the upper left corner of
your monitor ;-)

Seriously I meant that you should ensure the coordinates that you pass to
DrawReversibleFrame are screen coordinates, you can use
Control.PointToScreen & Control.RectangleToScreen to get client coordinates
into screen coordinates.

Hope this helps
Jay

"Raul Escobar" <anonymous@discussions.microsoft.com> wrote in message
news:05a701c399e6$78eb7310$a501280a@phx.gbl...
> I am drawing in a picturebox on a form using
> DrawReversibleFrame and DrawReversibleLine. It used to
> draw fine on the picturebox, now all of a sudden it does
> not appear on my form or application, but on VS.NET behind
> my application. Has anyone seen this behaviour, and/or is
> there any form/app settings that would affect this? Thanks.



Re: DrawReversibleFrame draws on VS.Net not my form by Raul

Raul
Fri Oct 24 13:00:26 CDT 2003

Non- MDI forms in my MDI app work OK, just the child forms
don't. So could it be related to the parent form? Funny
thing, it used to work fine, now it doesn't, so I suspect
an errant setting somewhere.

>-----Original Message-----
>Thanks for the answer. I do not have any such code, as
far
>as I know, but is there a form setting in either an MDI
>parent or child form that might cuase this? At one point,
>I had placed an image on the background of my mdiParent,
>but removed it, because the redraw was too slow. Is there
>some setting that might have been changed that might
cause
>rhis type of thing? I've verified that a new project
works
>fine, but adding test pictureboxes in my MDI application
>doesn't work. Thanks alot!
>
>>-----Original Message-----
>>DrawReversibleFrame draws on the desktop, not on any
>specific window so if
>>something you're doing, such as animation with a timer,
>is refreshing the
>>form, it will appear as though the frame is behind your
>window.
>>
>>--
>>Bob Powell [MVP]
>>C#, System.Drawing
>>
>>The October edition of Well Formed is now available.
>>Find out how to use DirectX in a Windows Forms control
>>http://www.bobpowell.net/currentissue.htm
>>
>>Answer those GDI+ questions with the GDI+ FAQ
>>http://www.bobpowell.net/gdiplus_faq.htm
>>
>>Blog http://bobpowelldotnet.blogspot.com
>>
>>"Raul Escobar" <anonymous@discussions.microsoft.com>
>wrote in message
>>news:05a701c399e6$78eb7310$a501280a@phx.gbl...
>>> I am drawing in a picturebox on a form using
>>> DrawReversibleFrame and DrawReversibleLine. It used to
>>> draw fine on the picturebox, now all of a sudden it
does
>>> not appear on my form or application, but on VS.NET
>behind
>>> my application. Has anyone seen this behaviour, and/or
>is
>>> there any form/app settings that would affect this?
>Thanks.
>>
>>
>>.
>>
>.
>

Re: DrawReversibleFrame draws on VS.Net not my form by Raul

Raul
Fri Oct 24 13:46:43 CDT 2003

Coordinated should be OK. A previous version of the
program runs correctly, maximized or not, the current non-
MDI forms work correctly when not maximized or in upper
left, but MDI kids dont work, with the same code copied
and pasted in. I compared the mouse code between the old
working form and the new non-working form, and that code
is the same, that's why I suspect a refreshing-form-
setting scenario. Are there settings that behave like the
old AutoRedraw that might be causing a form refresh or
someting? Appreciate the help (a lot!)


The test code that works in non-mdi, but not in mdi kids.:


' True while we are drawing the new line.
Private m_Drawing As Boolean

' Buffer for erasing rubberband lines.
Private m_BufferBitmap As Bitmap
Private m_BufferGraphics As Graphics

' The mouse position.
Private m_Pos1 As Point
Private m_Pos2 As Point


Private Sub picTest_MouseDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
picTest.MouseDown
' Do nothing if this isn't the left mouse button.
If e.Button <> MouseButtons.Left Then Exit Sub
m_Drawing = True

' Save the current mouse position.
m_Pos1 = Control.MousePosition
m_Pos2 = m_Pos1

End Sub

Private Sub picTest_MouseMove(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
picTest.MouseMove
' Do nothing if we're not drawing.
If Not m_Drawing Then Exit Sub

' Erase the previous line.
ControlPaint.DrawReversibleLine( _
m_Pos1, m_Pos2, Me.BackColor)

' Save the new point.
m_Pos2 = Control.MousePosition

' Draw the new line.
ControlPaint.DrawReversibleLine( _
m_Pos1, m_Pos2, Me.BackColor)

End Sub

Private Sub picTest_MouseUp(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
picTest.MouseUp
' Do nothing if we're not drawing.
If Not m_Drawing Then Exit Sub
m_Drawing = False

End Sub


>-----Original Message-----
>Raul,
>As Bob stated, DrawReversibleFrame draws on the desktop,
in other words you
>pass it screen coordinates to do the drawing.
>
>If you are passing it Client coordinates and your window
is not in the upper
>left corner of your monitor, then YES it will draw on
VS.NET, assuming that
>VS.NET is behind your app and you have VS.NET maximized.
>
>One way to fix this is to move your app window to the
upper left corner of
>your monitor ;-)
>
>Seriously I meant that you should ensure the coordinates
that you pass to
>DrawReversibleFrame are screen coordinates, you can use
>Control.PointToScreen & Control.RectangleToScreen to get
client coordinates
>into screen coordinates.
>
>Hope this helps
>Jay
>
>"Raul Escobar" <anonymous@discussions.microsoft.com>
wrote in message
>news:05a701c399e6$78eb7310$a501280a@phx.gbl...
>> I am drawing in a picturebox on a form using
>> DrawReversibleFrame and DrawReversibleLine. It used to
>> draw fine on the picturebox, now all of a sudden it does
>> not appear on my form or application, but on VS.NET
behind
>> my application. Has anyone seen this behaviour, and/or
is
>> there any form/app settings that would affect this?
Thanks.
>
>
>.
>

Re: DrawReversibleFrame draws on VS.Net not my form by Raul

Raul
Fri Oct 24 14:17:31 CDT 2003

I recreated my MDI Parent form (trashed the old one,
created a new one, copied the code and controls) and now
the Reversible frames work OK. I can only surmise that
there must have been a setting relative to adding a
background image that caused the aberrant behaviour, but,
it's all better now so I'm happy. Thanks for the help!
Just having the conversation helped alot.

>-----Original Message-----
>Raul,
>As Bob stated, DrawReversibleFrame draws on the desktop,
in other words you
>pass it screen coordinates to do the drawing.
>
>If you are passing it Client coordinates and your window
is not in the upper
>left corner of your monitor, then YES it will draw on
VS.NET, assuming that
>VS.NET is behind your app and you have VS.NET maximized.
>
>One way to fix this is to move your app window to the
upper left corner of
>your monitor ;-)
>
>Seriously I meant that you should ensure the coordinates
that you pass to
>DrawReversibleFrame are screen coordinates, you can use
>Control.PointToScreen & Control.RectangleToScreen to get
client coordinates
>into screen coordinates.
>
>Hope this helps
>Jay
>
>"Raul Escobar" <anonymous@discussions.microsoft.com>
wrote in message
>news:05a701c399e6$78eb7310$a501280a@phx.gbl...
>> I am drawing in a picturebox on a form using
>> DrawReversibleFrame and DrawReversibleLine. It used to
>> draw fine on the picturebox, now all of a sudden it does
>> not appear on my form or application, but on VS.NET
behind
>> my application. Has anyone seen this behaviour, and/or
is
>> there any form/app settings that would affect this?
Thanks.
>
>
>.
>

Re: DrawReversibleFrame draws on VS.Net not my form by Jay

Jay
Fri Oct 24 16:49:25 CDT 2003

Raul,
Just so you know:
> ' Save the current mouse position.
> m_Pos1 = Control.MousePosition
> m_Pos2 = m_Pos1
Works, as Control.MousePosition is defined to be in Screen Coordinates. If
you had used the MouseEventArgs.X & MouseEventArgs.Y properties it would not
work, as MouseEventArgs X & Y are in client coordinates.

> setting scenario. Are there settings that behave like the
> old AutoRedraw that might be causing a form refresh or
> someting? Appreciate the help (a lot!)
> ' Draw the new line.
> ControlPaint.DrawReversibleLine( _
> m_Pos1, m_Pos2, Me.BackColor)
There are no settings, as ControlPaint.DrawReversibleLine is defined to take
Screen Coordinates.

Seeing are you are passing Control.MousePosition which are also in Screen
Coordinates every thing should work as you expect it.

Note: You may want to review the chapter on "Taming the Mouse" in Charles
Petzold's book "Programming Microsoft Windows with Microsoft Visual Basic
.NET - Core Reference" from MS Press. It covers mouse capture and when you
may loose mouse capture unexpectedly. In other words when you may not
receive a MouseUp for the MouseDown.

Hope this helps
Jay

"Raul Escobar" <raulescobar@filenet.com> wrote in message
news:00c101c39a5f$2b834660$a601280a@phx.gbl...
> Coordinated should be OK. A previous version of the
> program runs correctly, maximized or not, the current non-
> MDI forms work correctly when not maximized or in upper
> left, but MDI kids dont work, with the same code copied
> and pasted in. I compared the mouse code between the old
> working form and the new non-working form, and that code
> is the same, that's why I suspect a refreshing-form-
> setting scenario. Are there settings that behave like the
> old AutoRedraw that might be causing a form refresh or
> someting? Appreciate the help (a lot!)
>
>
> The test code that works in non-mdi, but not in mdi kids.:
>
>
> ' True while we are drawing the new line.
> Private m_Drawing As Boolean
>
> ' Buffer for erasing rubberband lines.
> Private m_BufferBitmap As Bitmap
> Private m_BufferGraphics As Graphics
>
> ' The mouse position.
> Private m_Pos1 As Point
> Private m_Pos2 As Point
>
>
> Private Sub picTest_MouseDown(ByVal sender As Object,
> ByVal e As System.Windows.Forms.MouseEventArgs) Handles
> picTest.MouseDown
> ' Do nothing if this isn't the left mouse button.
> If e.Button <> MouseButtons.Left Then Exit Sub
> m_Drawing = True
>
> ' Save the current mouse position.
> m_Pos1 = Control.MousePosition
> m_Pos2 = m_Pos1
>
> End Sub
>
> Private Sub picTest_MouseMove(ByVal sender As Object,
> ByVal e As System.Windows.Forms.MouseEventArgs) Handles
> picTest.MouseMove
> ' Do nothing if we're not drawing.
> If Not m_Drawing Then Exit Sub
>
> ' Erase the previous line.
> ControlPaint.DrawReversibleLine( _
> m_Pos1, m_Pos2, Me.BackColor)
>
> ' Save the new point.
> m_Pos2 = Control.MousePosition
>
> ' Draw the new line.
> ControlPaint.DrawReversibleLine( _
> m_Pos1, m_Pos2, Me.BackColor)
>
> End Sub
>
> Private Sub picTest_MouseUp(ByVal sender As Object,
> ByVal e As System.Windows.Forms.MouseEventArgs) Handles
> picTest.MouseUp
> ' Do nothing if we're not drawing.
> If Not m_Drawing Then Exit Sub
> m_Drawing = False
>
> End Sub
>
>
> >-----Original Message-----
> >Raul,
> >As Bob stated, DrawReversibleFrame draws on the desktop,
> in other words you
> >pass it screen coordinates to do the drawing.
> >
> >If you are passing it Client coordinates and your window
> is not in the upper
> >left corner of your monitor, then YES it will draw on
> VS.NET, assuming that
> >VS.NET is behind your app and you have VS.NET maximized.
> >
> >One way to fix this is to move your app window to the
> upper left corner of
> >your monitor ;-)
> >
> >Seriously I meant that you should ensure the coordinates
> that you pass to
> >DrawReversibleFrame are screen coordinates, you can use
> >Control.PointToScreen & Control.RectangleToScreen to get
> client coordinates
> >into screen coordinates.
> >
> >Hope this helps
> >Jay
> >
> >"Raul Escobar" <anonymous@discussions.microsoft.com>
> wrote in message
> >news:05a701c399e6$78eb7310$a501280a@phx.gbl...
> >> I am drawing in a picturebox on a form using
> >> DrawReversibleFrame and DrawReversibleLine. It used to
> >> draw fine on the picturebox, now all of a sudden it does
> >> not appear on my form or application, but on VS.NET
> behind
> >> my application. Has anyone seen this behaviour, and/or
> is
> >> there any form/app settings that would affect this?
> Thanks.
> >
> >
> >.
> >



Re: DrawReversibleFrame draws on VS.Net not my form by Bob

Bob
Sat Oct 25 04:47:54 CDT 2003

Are you calling DrawReversibleFrame from the MDI parent or the child? The
children are painted after the parent so they may be overwriting the frame.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

"Raul Escobar" <raulescobar@yahoo.com> wrote in message
news:020301c39a58$b3de5d80$a301280a@phx.gbl...
> Non- MDI forms in my MDI app work OK, just the child forms
> don't. So could it be related to the parent form? Funny
> thing, it used to work fine, now it doesn't, so I suspect
> an errant setting somewhere.
>
> >-----Original Message-----
> >Thanks for the answer. I do not have any such code, as
> far
> >as I know, but is there a form setting in either an MDI
> >parent or child form that might cuase this? At one point,
> >I had placed an image on the background of my mdiParent,
> >but removed it, because the redraw was too slow. Is there
> >some setting that might have been changed that might
> cause
> >rhis type of thing? I've verified that a new project
> works
> >fine, but adding test pictureboxes in my MDI application
> >doesn't work. Thanks alot!
> >
> >>-----Original Message-----
> >>DrawReversibleFrame draws on the desktop, not on any
> >specific window so if
> >>something you're doing, such as animation with a timer,
> >is refreshing the
> >>form, it will appear as though the frame is behind your
> >window.
> >>
> >>--
> >>Bob Powell [MVP]
> >>C#, System.Drawing
> >>
> >>The October edition of Well Formed is now available.
> >>Find out how to use DirectX in a Windows Forms control
> >>http://www.bobpowell.net/currentissue.htm
> >>
> >>Answer those GDI+ questions with the GDI+ FAQ
> >>http://www.bobpowell.net/gdiplus_faq.htm
> >>
> >>Blog http://bobpowelldotnet.blogspot.com
> >>
> >>"Raul Escobar" <anonymous@discussions.microsoft.com>
> >wrote in message
> >>news:05a701c399e6$78eb7310$a501280a@phx.gbl...
> >>> I am drawing in a picturebox on a form using
> >>> DrawReversibleFrame and DrawReversibleLine. It used to
> >>> draw fine on the picturebox, now all of a sudden it
> does
> >>> not appear on my form or application, but on VS.NET
> >behind
> >>> my application. Has anyone seen this behaviour, and/or
> >is
> >>> there any form/app settings that would affect this?
> >Thanks.
> >>
> >>
> >>.
> >>
> >.
> >



Re: DrawReversibleFrame draws on VS.Net not my form by Bob

Bob
Sat Oct 25 04:49:26 CDT 2003

Ah great, I'm glad you sorted it out. I posted the other reply before I saw
this answer from you.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

"Raul Escobar" <raulescobar@yahoo.com> wrote in message
news:022201c39a63$78961f50$a401280a@phx.gbl...
> I recreated my MDI Parent form (trashed the old one,
> created a new one, copied the code and controls) and now
> the Reversible frames work OK. I can only surmise that
> there must have been a setting relative to adding a
> background image that caused the aberrant behaviour, but,
> it's all better now so I'm happy. Thanks for the help!
> Just having the conversation helped alot.
>
> >-----Original Message-----
> >Raul,
> >As Bob stated, DrawReversibleFrame draws on the desktop,
> in other words you
> >pass it screen coordinates to do the drawing.
> >
> >If you are passing it Client coordinates and your window
> is not in the upper
> >left corner of your monitor, then YES it will draw on
> VS.NET, assuming that
> >VS.NET is behind your app and you have VS.NET maximized.
> >
> >One way to fix this is to move your app window to the
> upper left corner of
> >your monitor ;-)
> >
> >Seriously I meant that you should ensure the coordinates
> that you pass to
> >DrawReversibleFrame are screen coordinates, you can use
> >Control.PointToScreen & Control.RectangleToScreen to get
> client coordinates
> >into screen coordinates.
> >
> >Hope this helps
> >Jay
> >
> >"Raul Escobar" <anonymous@discussions.microsoft.com>
> wrote in message
> >news:05a701c399e6$78eb7310$a501280a@phx.gbl...
> >> I am drawing in a picturebox on a form using
> >> DrawReversibleFrame and DrawReversibleLine. It used to
> >> draw fine on the picturebox, now all of a sudden it does
> >> not appear on my form or application, but on VS.NET
> behind
> >> my application. Has anyone seen this behaviour, and/or
> is
> >> there any form/app settings that would affect this?
> Thanks.
> >
> >
> >.
> >