• 0

[VB.NET] Draw Line on Flow Control Panel


Question

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

2 answers to this question

Recommended Posts

  • 0
  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?

  • 0
  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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.