James Rose Posted October 31, 2007 Share Posted October 31, 2007 Hey gang, I'm in need of the ability to draw a box around a picture control (frame it) and my code works fine Dim penGray As New System.Drawing.Pen(System.Drawing.Color.DarkGray) Dim grpLine As System.Drawing.Graphics grpLine = Me.CreateGraphics() grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX2, Me.FrameY1) grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX1, Me.FrameY2) grpLine.DrawLine(penGray, Me.FrameX2, Me.FrameY1, Me.FrameX2, Me.FrameY2) grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY2, Me.FrameX2, Me.FrameY2) 'The me.FrameX... are properties... not a real issue. The problem is, I want to draw these lines not on the Form but on a Flow Control Panel. Any ideas? Thanks, James Link to comment https://www.neowin.net/forum/topic/597823-vbnet-draw-line-on-flow-control-panel/ Share on other sites More sharing options...
0 azcodemonkey Posted November 1, 2007 Share Posted November 1, 2007 jameswjrose said: Hey gang,I'm in need of the ability to draw a box around a picture control (frame it) and my code works fine Dim penGray As New System.Drawing.Pen(System.Drawing.Color.DarkGray) Dim grpLine As System.Drawing.Graphics grpLine = Me.CreateGraphics() grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX2, Me.FrameY1) grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX1, Me.FrameY2) grpLine.DrawLine(penGray, Me.FrameX2, Me.FrameY1, Me.FrameX2, Me.FrameY2) grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY2, Me.FrameX2, Me.FrameY2) 'The me.FrameX... are properties... not a real issue. The problem is, I want to draw these lines not on the Form but on a Flow Control Panel. Any ideas? Thanks, James Create a Graphics object from the handle of the Flow Control Panel. Graphics g = Graphics.FromHwnd(flowLayoutPanel1.Handle); g.DrawLine(Pens.Black, 25f, 25f, 75f, 25f); Or handle the flow control panel's Paint event. Am I missing what it is you want to do? Link to comment https://www.neowin.net/forum/topic/597823-vbnet-draw-line-on-flow-control-panel/#findComment-588960813 Share on other sites More sharing options...
0 James Rose Posted November 1, 2007 Author Share Posted November 1, 2007 azcodemonkey said: Create a Graphics object from the handle of the Flow Control Panel. Graphics g = Graphics.FromHwnd(flowLayoutPanel1.Handle); g.DrawLine(Pens.Black, 25f, 25f, 75f, 25f); Or handle the flow control panel's Paint event. Am I missing what it is you want to do? You got it. Thank you so VERY much. I owe you one. Thanks, James Link to comment https://www.neowin.net/forum/topic/597823-vbnet-draw-line-on-flow-control-panel/#findComment-588961629 Share on other sites More sharing options...
Question
James Rose
Hey gang,
I'm in need of the ability to draw a box around a picture control (frame it) and my code works fine
Dim penGray As New System.Drawing.Pen(System.Drawing.Color.DarkGray)
Dim grpLine As System.Drawing.Graphics
grpLine = Me.CreateGraphics()
grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX2, Me.FrameY1)
grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX1, Me.FrameY2)
grpLine.DrawLine(penGray, Me.FrameX2, Me.FrameY1, Me.FrameX2, Me.FrameY2)
grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY2, Me.FrameX2, Me.FrameY2)
'The me.FrameX... are properties... not a real issue.
The problem is, I want to draw these lines not on the Form but on a Flow Control Panel.
Any ideas?
Thanks,
James
Link to comment
https://www.neowin.net/forum/topic/597823-vbnet-draw-line-on-flow-control-panel/Share on other sites
2 answers to this question
Recommended Posts