private void RangeCanvas() { ViewContainer.UpdateLayout(); OriginalImage.UpdateLayout(); EventCanvas.Children.Clear(); EventCanvas.Width = ViewContainer.ActualWidth; EventCanvas.Height = ViewContainer.ActualHeight; ObjectCanvas.Width = ViewContainer.ActualWidth; ObjectCanvas.Height = ViewContainer.ActualHeight; var rect = new Rectangle { Width = ViewContainer.ActualWidth, Height = ViewContainer.ActualHeight, Stroke = new SolidColorBrush(Colors.Transparent), Fill = new SolidColorBrush(Colors.Transparent) }; var objRect = new Rectangle { Width = ViewContainer.ActualWidth, Height = ViewContainer.ActualHeight, Stroke = new SolidColorBrush(Colors.Transparent), Fill = new SolidColorBrush(Colors.Transparent) }; EventCanvas.Children.Add(rect); ObjectCanvas.Children.Add(objRect); f_Ratio = ((EventCanvas.Width / f_OrigWidth) + (EventCanvas.Height / f_OrigHeight)) / 2; }