Exemple #1
0
        private static void RatioChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                Console.WriteLine("ZoomPanel: change RatioProperty is null"); return;
            }

            ZoomPanel panel = d as ZoomPanel;
            string    ratio = e.NewValue as string;
            Regex     regex = new Regex(@"\d[:]\d");


            if (regex.IsMatch(ratio))
            {
                string[] rs = Regex.Split(ratio, ":");
                panel.zoomy = int.Parse(rs[0]);
                panel.zoomx = int.Parse(rs[1]);
                Console.WriteLine("set: zoomx=" + panel.zoomx.ToString());
                Console.WriteLine("set: zoomy=" + panel.zoomy.ToString());
            }
            else
            {
                panel.zoomy = 1;
                panel.zoomx = 2;
                Console.WriteLine("BasicWaveChart: ratio's format is not valid");
            }

            return;
            //throw new NotImplementedException();
        }
Exemple #2
0
        public double GetGranulity()
        {
            Canvas           cp = this.Parent as Canvas;
            ZoomPanel        zp = cp.Parent as ZoomPanel;
            BasicWaveChartUC p  = zp.Parent as BasicWaveChartUC;

            granulity_width = p.WindowCanvas_pen.Width / XScaleMaxValue;
            return(granulity_width);
        }