private void UserControl_Loaded(object sender, RoutedEventArgs e) { this.MouseLeftButtonDown += new MouseButtonEventHandler(StickyNoteTab_MouseLeftButtonDown); this.MouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler); this.MouseMove += new MouseEventHandler(StickyNoteTab_MouseMove); this.MouseLeave += new MouseEventHandler(StickyNoteTab_MouseLeave); //rtbEditor.MouseLeftButtonDown += new MouseButtonEventHandler(Editor_MouseLeftButtonDown); rtbEditor.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Editor_MouseLeftButtonDown); aLayer = AdornerLayer.GetAdornerLayer(this); adorner = new ResizingAdorner(this, cornerThumbStyle, sideThumbStyle); aLayer.Add(adorner); //myCanvas.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(myCanvas_PreviewMouseLeftButtonDown); //myCanvas.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler); }
void Editor_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { //MessageBox.Show(e.Source.ToString()); if (e.Source is Image) { Image currImage = e.Source as Image; aLayer = AdornerLayer.GetAdornerLayer(currImage); adorner = new ResizingAdorner(currImage, cornerThumbStyle_Visible, sideThumbStyle); aLayer.Add(adorner); selectedElement = currImage; selected = true; } else if (e.Source is Paragraph) { selected = false; if (selectedElement != null) { aLayer.Remove(aLayer.GetAdorners(selectedElement)[0]); selectedElement = null; } } }