public static StreamControl CreateOnCanvas(DrawingCanvas canvas, AbstractStream stream) { StreamControl streamControl = new StreamControl(canvas, stream); canvas.AddNewChild(streamControl); return(streamControl); }
public void MouseMove(object sender, MouseEventArgs e) { if (null == m_placementIcon) { return; } // Set the location of the icon to follow the mouse Point p = e.GetPosition(m_canvas); m_placementIcon.SetValue(Canvas.LeftProperty, p.X - m_placementIcon.Width / 2.0); m_placementIcon.SetValue(Canvas.TopProperty, p.Y - m_placementIcon.Height / 2.0); // If we've highlighted a process unit or stream then clear the highlight UnhighlightHover(); // See if we're hovering over a process unit (will be null if we're not) m_highlightedHover = m_canvas.GetChildAtIncludeStreams(p, m_placementIcon); ProcessUnitControl pu = m_highlightedHover as ProcessUnitControl; ChemProV.PFD.Streams.StreamControl stream = m_highlightedHover as ChemProV.PFD.Streams.StreamControl; // Set the border if we are hovering over a process unit to indicate that we can attach // an anchored comment to it if (null != pu) { pu.SetBorderColor(ProcessUnitBorderColor.AcceptingStreams); } else if (null != stream) { stream.SetLineBrush(new SolidColorBrush(Colors.Green)); } }
public DraggableStreamEndpoint(EndpointType endpointType, StreamControl owner, DrawingCanvas canvas) { InitializeComponent(); m_id = s_idCounter; s_idCounter++; m_canvas = canvas; m_owner = owner; m_type = endpointType; // Initialize the icon RebuildIcon(); }