private static Point GetLinkControlLocationBy(Control activityControl, ActivityControlsLink activityControlsLink, Control linkControl){ NeighbourDirections direction = activityControlsLink.Direction; int x = activityControl.Location.X; int y = activityControl.Location.Y; if (direction == NeighbourDirections.Top){ x += 5; y -= 5; } else if (direction == NeighbourDirections.Bottom) { x += 5; y += activityControl.Height - 5; } else if (direction == NeighbourDirections.Left){ x -= 5; // y += 5; } else {//Right x += activityControl.Width - 5; // y += 5; } if (direction == NeighbourDirections.Top || direction == NeighbourDirections.Bottom) { linkControl.Width = activityControl.Width - 10; linkControl.Height = 10; } else{ linkControl.Height = activityControl.Height;// -10; linkControl.Width = 10; } return new Point(x, y); }
private void InitLinkControlBy(Control control, ActivityControlsLink sourceActivityControlsLink){ if (sourceActivityControlsLink == null) return; var linkControl = new ActivitiesLinkControl(sourceActivityControlsLink); Controls.Add(linkControl); linkControl.Location = GetLinkControlLocationBy(control, sourceActivityControlsLink, linkControl); linkControl.BringToFront(); }
public void PlaceActivityControlAt(int column, int row, IActivityControl activityControl, ActivityControlsLink sourceActivityControlsLink){ var control = (Control) activityControl; Controls.Add(control); control.Location = new Point(column*CellWH, row*CellWH); control.Size = new Size(CellWH, CellWH); control.BringToFront(); InitLinkControlBy(control, sourceActivityControlsLink); }
private void InitBy(ActivityControlsLink activityControlsLink){ if (activityControlsLink == null) return; NeighbourDirections direction = activityControlsLink.Direction; pbTop.Visible = (direction == NeighbourDirections.Bottom); pbBottom.Visible = (direction == NeighbourDirections.Top); pbLeft.Visible = (direction == NeighbourDirections.Right); pbRight.Visible = (direction == NeighbourDirections.Left); if (direction == NeighbourDirections.Top || direction == NeighbourDirections.Bottom) SetHorizontalSize(); if (direction == NeighbourDirections.Left || direction == NeighbourDirections.Right) SetVerticalSize(); }
public ActivitiesLinkControl(ActivityControlsLink activityControlsLink){ InitializeComponent(); InitBy(activityControlsLink); }