public static void PositionActivity(Activity activity, int x, int y)
        {
            if (activity.Process == null)
            {
                throw new InvalidOperationException("Add the activity to a process before setting its position.");
            }

            ProcessView processView = EnsureProcessView(activity.Process);

            processView.ActivityLayoutData(activity).Location = new System.Drawing.Point(x, y);
        }
        public static Rect GetActivityDimensions(Activity activity)
        {
            if (activity.Process == null)
            {
                throw new InvalidOperationException("Add the activity to a process before getting its position.");
            }

            ProcessView processView = EnsureProcessView(activity.Process);

            var data = processView.ActivityLayoutData(activity);

            return(new Rect()
            {
                X = data.Location.X,
                Y = data.Location.Y,
                Width = data.UserSize.Width,
                Height = data.UserSize.Height
            });
        }
        public static void AutoPositionLines(ActivityLineCollection lines)
        {
            if (lines.Count == 0)
            {
                return;
            }

            Activity    activity    = lines[0].StartActivity;
            ProcessView processView = EnsureProcessView(activity.Process);

            ProcessViewActivityLayoutData layout = processView.ActivityLayoutData(activity);
            int lineSpacing = layout.UserSize.Width / lines.Count;
            int offset      = lineSpacing / 2;

            for (int i = 0; i < lines.Count; i++)
            {
                Line line = lines[i];
                processView.LineLayoutData(line).StartOffsetMaximized =
                    new System.Drawing.Point(offset, processView.LineLayoutData(line).StartOffsetMaximized.Y);
                offset += lineSpacing;
            }
        }