예제 #1
0
        private void enlarge_Click(object sender, RoutedEventArgs e) //放大
        {
            NUM -= (int)(NUM * R);                                   //最终单元格个数

            if (NUM < 2)
            {
                NUM = 2;//锁定单元格下限为2
                return;
            }

            stackPanel_XySys.Children.Remove(mySys);//重绘坐标系
            xySys xysys = new xySys();

            mySys = xysys.createSys(_WH_CANVAS, NUM, SYSMODE);
            stackPanel_XySys.Children.Add(mySys);
            if (X_DOT == -1 || Y_DOT == -1)//文本框空时,不再执行描点操作
            {
                return;
            }

            stackPanel_XySys.Children.Remove(mySys);//描点
            xySysCtrl sysCtrl = new xySysCtrl();

            mySys = sysCtrl.drawDot(true);
            stackPanel_XySys.Children.Add(mySys);
        }
예제 #2
0
        public static int SYSMODE = 0; //填充模式,0表示完全填充,1表示内切圆填充

        public MainWindow()
        {
            InitializeComponent();

            _WH_CANVAS = (int)stackPanel_XySys.Width;//设置画布的边长

            //生成坐标系
            xySys xysys = new xySys();

            mySys = xysys.createSys(_WH_CANVAS, NUM, SYSMODE);
            stackPanel_XySys.Children.Add(mySys);
        }
예제 #3
0
        private void clearTxtBox_Click(object sender, RoutedEventArgs e) //清空文本框和网格所有内容
        {
            x_TxtBox.Text = "";                                          //清空x文本框
            y_TxtBox.Text = "";                                          //清空y文本框
            X_DOT         = -1;
            Y_DOT         = -1;
            stackPanel_XySys.Children.Remove(mySys);//重绘坐标系
            xySys newCanvas = new xySys();

            mySys = newCanvas.createSys(_WH_CANVAS, NUM, SYSMODE);
            stackPanel_XySys.Children.Add(mySys);
        }
예제 #4
0
        public Canvas drawDot(bool isFill)//描点函数
        {
            xySys  mySys     = new xySys();
            Canvas tmpCanvas = mySys.createSys(MainWindow._WH_CANVAS, MainWindow.NUM, MainWindow.SYSMODE);

            Point loc = new Point();//单元格的位置

            loc.X     = MainWindow.X_DOT;
            loc.Y     = MainWindow.Y_DOT;
            tmpCanvas = mySys.findAndFill_A_Cell(loc);//返回带点的画布

            return(tmpCanvas);
        }
예제 #5
0
        public Canvas toggleMode(int _SYS_MODE)//切换坐标系填充模式
        {
            xySys  mySys     = new xySys();
            Canvas tmpCanvas = mySys.createSys(MainWindow._WH_CANVAS, MainWindow.NUM, _SYS_MODE); //绘制坐标系

            if (MainWindow.X_DOT == -1 || MainWindow.Y_DOT == -1)                                 //如果文本框为空,则不描点
            {
                return(tmpCanvas);
            }
            tmpCanvas = drawDot(true);//描点

            return(tmpCanvas);
        }
예제 #6
0
        //offset_Left,左偏移量  //offset_Top,上偏移量
        //offset_Right,右偏移量  //offset_Bottom,下偏移量
        public Canvas turnSys(int offset_Left, int offset_Top, int offset_Right, int offset_Bottom)//变换坐标网格
        {
            xySys  mySys     = new xySys();
            Canvas tmpCanvas = mySys.createSys(MainWindow._WH_CANVAS, MainWindow.NUM, MainWindow.SYSMODE);

            Point loc = new Point();//单元格的位置

            loc.X            = MainWindow.X_DOT + (offset_Right - offset_Left);
            loc.Y            = MainWindow.Y_DOT + (offset_Bottom - offset_Top);
            MainWindow.X_DOT = MainWindow.X_DOT + (offset_Right - offset_Left); //改变用于记录当前点X坐标的变量
            MainWindow.Y_DOT = MainWindow.Y_DOT + (offset_Bottom - offset_Top); //改变用于记录当前点Y坐标的变量

            tmpCanvas = mySys.findAndFill_A_Cell(loc);                          //返回带点的画布

            return(tmpCanvas);
        }
예제 #7
0
        private void drawDot_Click(object sender, RoutedEventArgs e) //描点
        {
            if (x_TxtBox.Text == "" || y_TxtBox.Text == "")          //文本框值为空则返回
            {
                stackPanel_XySys.Children.Remove(mySys);             //重绘坐标系
                xySys tmpCanvas = new xySys();
                mySys = tmpCanvas.createSys(_WH_CANVAS, NUM, SYSMODE);
                stackPanel_XySys.Children.Add(mySys);

                return;
            }

            X_DOT = int.Parse(x_TxtBox.Text);
            Y_DOT = int.Parse(y_TxtBox.Text);

            //坐标系上描点
            stackPanel_XySys.Children.Remove(mySys);
            xySysCtrl sysCtrl   = new xySysCtrl();
            Canvas    newCanvas = sysCtrl.drawDot(true);

            mySys = newCanvas;
            stackPanel_XySys.Children.Add(mySys);
        }