void c_PointerReleased(object sender, PointerRoutedEventArgs e) { if (type == 2) { ep = e.GetCurrentPoint(pc.SelectLayer).Position; dg.DrawRectangle(sp.X, sp.Y, ep.X, ep.Y, false, 2, new SolidColorBrush(ForeColor), new SolidColorBrush(FillColor)); pc.SelectLayer.setSelect(dg.getRectangleGeometry(sp.X, sp.Y, ep.X, ep.Y)); } if (type == 3) { ep = e.GetCurrentPoint(pc.SelectLayer).Position; dg.DrawEllipse(sp.X, sp.Y, ep.X, ep.Y, false, 2, new SolidColorBrush(ForeColor), new SolidColorBrush(FillColor)); pc.SelectLayer.setSelect(dg.getEllipseGeometry(sp.X, sp.Y, ep.X, ep.Y)); } if (type == 5) { begin = false; c.PointerMoved -= new PointerEventHandler(c_PointerMoved); pc.SelectLayer.setSelect(pt.Data as PathGeometry); } c.PointerPressed -= new PointerEventHandler(c_PointerPressed); c.PointerReleased -= new PointerEventHandler(c_PointerReleased); e.Handled = true; }
//Color FillColor = Colors.Green; void c_PointerReleased(object sender, PointerRoutedEventArgs e) { if (type == 1) { ep = e.GetCurrentPoint(pc.SelectLayer).Position; dg.DrawLine(sp.X, sp.Y, ep.X, ep.Y, false, Convert.ToInt32(textW.Text), new SolidColorBrush(ForeColor)); } if (type == 2) { ep = e.GetCurrentPoint(pc.SelectLayer).Position; dg.DrawRectangle(sp.X, sp.Y, ep.X, ep.Y, checkBox1.IsChecked == true, Convert.ToInt32(textW.Text), new SolidColorBrush(ForeColor), new SolidColorBrush(ForeColor)); } if (type == 3) { ep = e.GetCurrentPoint(pc.SelectLayer).Position; dg.DrawEllipse(sp.X, sp.Y, ep.X, ep.Y, checkBox1.IsChecked == true, Convert.ToInt32(textW.Text), new SolidColorBrush(ForeColor), new SolidColorBrush(ForeColor)); } if (type == 4) { ep = e.GetCurrentPoint(pc.SelectLayer).Position; TextBox tb = dg.DrawEditText(sp.X, sp.Y, ep.X, ep.Y, "Text", new SolidColorBrush(ForeColor), ForeFont); tb.LostFocus += new RoutedEventHandler(tb_LostFocus); } if (type == 5) { begin = false; c.PointerMoved -= new PointerEventHandler(c_PointerMoved); } c.PointerPressed -= new PointerEventHandler(c_PointerPressed); c.PointerReleased -= new PointerEventHandler(c_PointerReleased); e.Handled = true; }