private void SetItemControlSelected(IItemControl control) { ItemControlType controlType = ItemControlTypes.TypesTable[control.GetType()]; if (controlType == ItemControlType.Button) { foreach (IItemControl c in ControlsOnScreen.Values) { c.Selected = c == control; } } }
private void CheckOnSelectedItemControlMouseMove(Point pos) { //No control handled mouse if (_itemControlThatHandledMouse == null) { return; } //Get current control type ItemControlType controlType = ItemControlTypes.TypesTable[_itemControlThatHandledMouse.GetType()]; switch (controlType) { //LinkPoint case ItemControlType.LinkPoint: { if (ReadOnly) { return; } LinkingArrow arrow = Parent.CurrentLinkingArrow; MapItem srcItem = arrow.SourceItem; //Get destionation item under mouse cursor MapItem destItem = Parent.GetItemForLinkingUnderCursor(this, srcItem, pos); //If destionation exists if (destItem != null) { //If destItem not setted yet as destination item for the current linking arrow if (destItem != arrow.DestinationItem) { //Set left link point selected destItem.LeftLinkPoint.Selected = true; arrow.DestinationItem = destItem; //Repaint self and parent Parent.Repaint(); destItem.Repaint(); } } //otherwise else { destItem = arrow.DestinationItem; if (destItem != null) { //Set left link point unselected destItem.LeftLinkPoint.Selected = false; //Repaint self destItem.Repaint(); //Drop destination item references destItem = arrow.DestinationItem = null; } //Update current linking arrow dest point according to mouse position Point point = Parent.PointToClient(PointToScreen(pos)); Parent.UpdateLinkingArrowEndPoint(arrow, point); Parent.Repaint(); } //Temporary set destination item for the current linking arrow arrow.DestinationItem = destItem; break; } } }