Exemple #1
0
        private static void OnParentScaleXPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            ZoomLabel thisLabel = (ZoomLabel)source;

            if (thisLabel.ParentScaleX != 0)
            {
                double tempScale = 1.0 / thisLabel.ParentScaleX;
                thisLabel.SetScaleX(tempScale);
            }
        }
Exemple #2
0
        private static void OnParentScaleYPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            // Put some update logic here...
            ZoomLabel thisLabel = (ZoomLabel)source;

            if (thisLabel.ParentScaleY != 0)
            {
                double tempScale = 1.0 / thisLabel.ParentScaleY;
                thisLabel.SetScaleY(tempScale);
            }
        }
Exemple #3
0
        /// <summary>
        /// When the canvas size changes. ie on window maximization, recalculates the position of the label in the canvas
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private static void OnParentWidthAndHeightPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            ZoomLabel thisLabel = (ZoomLabel)source;    //get this label

            thisLabel.ReinitializePosition(null, null); //update its margins based on the new size
        }