private void OnRectMaskSelected(object sender, RectMaskEventArgs e) { if (e.Width == 0 && e.Height == 0 && e.ActuralW == 0 && e.ActuralH == 0) { RemoveTempMarker(); } else { RemoveTempMarker(); MainWindow mv = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); double x = e.P.X / e.ActuralW * Width; double y = e.P.Y / e.ActuralH * Height; double w = e.Width * Width / e.ActuralW; double h = e.Height * Height / e.ActuralH; tmpRect = DrawCanvas.Rect(x, y, (int)w, (int)h, Brushes.Red, mv.CanvasDraw, 0.3); } }
protected virtual void RaiseRectMaskSelectedEvent(RectMaskEventArgs eventArgs) { RectMaskSelected?.Invoke(this, eventArgs); }