Is it possible to draw a line as shown in the pic on a single form The line in the image is drawn on a second form which is transparent so form1 is visible.
Windows Forms General
So why does my line control cover the listbox
class Line : Control
{
Pen _Pen;
Line()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;
}
public void SetBounds(int Width)
{
_Pen = new Pen(new SolidBrush(Color.Red));
_Pen.Width = Width;
this.Location = new Point(0, 0);
this.Height = Form1.ClientRectangle.Height;
this.Width = Form1.ClientRectangle.Width;
Invalidate();
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
_Pen.DashCap = DashCap.Flat;
_Pen.DashStyle = DashStyle.DashDotDot;
_Pen.StartCap = LineCap.Flat;
_Pen.EndCap = LineCap.ArrowAnchor;
Graphics g = this.CreateGraphics;
g.DrawBezier(_Pen, 20, 20, 500, 300, 550, 320, 510, 60);
}
}