UserControl объединение
Я пытаюсь сделать свой контрол в виде стрелки, но пустая область вокруг контрола, перекрывает другие. Пробовал передать в регион созданный myPath но тогда пропадает стрелка. Ниже пример контрола со стрелкой.
Как сделать область вокруг прозрачной когда я использую этот контрол на форме?
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);
Graphics graph = pevent.Graphics;
Pen pen1 = new Pen(Color.Black, 3);
AdjustableArrowCap cup = new AdjustableArrowCap(System.Convert.ToInt32(Math.Floor(2* 2.5)), System.Convert.ToInt32(Math.Floor(2* 2.5)));
#region ArrowCup
pen1.CustomEndCap = cup;
pen1.CustomStartCap = cup;
#endregion
pen1.DashStyle = DashStyle.Dash;
GraphicsPath myPath = new GraphicsPath();
//graph.DrawLine(pen1, Width / 2, 0, Width / 2, Height);
Point[] myArray =
{
new Point(Width / 2, 0),
new Point(Width / 2, Height)
};
myPath.AddLines(myArray);
//Color.Transparent;
//Region reg = new Region(myPath);
//reg.Union(new Rectangle(0,0,Width,Height));
//this.Region = reg;
//pevent.Graphics.Clip = reg;
//pevent.Graphics.FillRegion( ,reg);
//pevent.Graphics.FillPath(Brushes.Transparent, myPath);
pevent.Graphics.DrawPath(pen1, myPath);
//pevent.Graphics.DrawLines(pen1, myArray );
}
