Beispiel #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            GraphicsState st = e.Graphics.Save();
            ActiveDrawing ei = PortOwner as ActiveDrawing;
            Point         p0 = ei.Center;
            Point         p1 = this.Center;
            double        a;

            if (p0.Y == p1.Y)
            {
                if (p1.X > p0.X)
                {
                    a = -Math.PI / 2.0;
                }
                else
                {
                    a = Math.PI / 2.0;
                }
            }
            else
            {
                a = -Math.Atan2((double)(p1.X - p0.X), ((double)(p1.Y - p0.Y)));
            }
            e.Graphics.TranslateTransform(this.Size.Width / 2, this.Size.Height / 2, System.Drawing.Drawing2D.MatrixOrder.Prepend);
            e.Graphics.RotateTransform((float)(a * 180.0 / Math.PI));
            e.Graphics.TranslateTransform(-this.Size.Width / 2, -this.Size.Height / 2, System.Drawing.Drawing2D.MatrixOrder.Prepend);
            VplDrawing.DrawInArrow(e.Graphics, _drawBrush, this.Size, enumPositionType.Bottom);
            e.Graphics.Restore(st);
        }
 protected override void OnPaint(PaintEventArgs e)
 {
     VplDrawing.DrawInArrow(e.Graphics, _drawBrush, this.Size, this.PositionType);
 }