Esempio n. 1
0
        private static void OriginSource_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            CvsDisplay control = (CvsDisplay)o;

            if (e.OldValue == null)
            {
                var img = e.NewValue as ImageSource;
                control.ContentScale = control.ActualWidth > control.ActualHeight ? (control.ActualHeight - 20 > 0 ? (control.ActualHeight - 20) / img.Height : 0) : (control.ActualWidth - 20 > 0 ? (control.ActualWidth - 20) / img.Width : 0);
            }
        }
Esempio n. 2
0
        private static void Overlay_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            CvsDisplay control = (CvsDisplay)o;
            var        img     = new DrawingImage(e.NewValue as DrawingGroup);

            if (img.CanFreeze)
            {
                img.Freeze();
                control.Overlay_Image.Source = img;
            }
        }