public PlacingNewProcessUnit(ControlPalette sender, DrawingCanvas canvas, Type processUnitType) { m_canvas = canvas; m_palette = sender; m_type = processUnitType; m_workspace = canvas.GetWorkspace(); SolidColorBrush whiteBrush = new SolidColorBrush(Colors.White); // Create the placement icon. This will hover under the mouse pointer // as it moves and a mouse-down event will complete the placement. BitmapImage bmp = new BitmapImage(); bmp.UriSource = new Uri(ProcessUnitControl.GetIconSource(processUnitType), UriKind.Relative); Image img = new Image() { Source = bmp, Width = 44.0, Height = 44.0 }; m_placementIcon = new Border(); m_placementIcon.Background = whiteBrush; m_placementIcon.Child = img; m_placementIcon.BorderThickness = new Thickness(0.0); // Add it to the canvas but don't show it until we get our first mouse-move event canvas.AddNewChild(m_placementIcon); m_placementIcon.Visibility = Visibility.Collapsed; // Deselect canvas.SelectedElement = null; }
public PlacingNewCommentNote(DrawingCanvas canvas, ControlPalette creator) { // Store the reference to the drawing canvas. This is where we will place the new // sticky note. m_canvas = canvas; // Store a reference to the control palette m_creator = creator; // Create the placement icon and add it to the canvas. This will move around under the mouse // until the user clicks in order to create it. m_placementIcon = Core.App.CreateImageFromSource("palette_stickyNote_16x16.png"); m_placementIcon.Width = m_placementIcon.Height = 16; m_canvas.AddNewChild(m_placementIcon); }