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); }
private void toggleMode_Click(object sender, RoutedEventArgs e) //切换填充模式 { { //将填充模式变量在0和1之间切换 SYSMODE++; SYSMODE %= 2; } //重绘坐标系 stackPanel_XySys.Children.Remove(mySys); xySysCtrl ctrl = new xySysCtrl(); Canvas newCanvas = ctrl.toggleMode(SYSMODE); mySys = newCanvas; stackPanel_XySys.Children.Add(mySys); }
private void turn_right_Click(object sender, RoutedEventArgs e) //右移点 { if (x_TxtBox.Text == "" || y_TxtBox.Text == "") //文本框空则移动函数无效 { return; } //坐标系上描点 stackPanel_XySys.Children.Remove(mySys); xySysCtrl sysCtrl = new xySysCtrl(); Canvas newCanvas = sysCtrl.turnSys(0, 0, 1, 0); mySys = newCanvas; stackPanel_XySys.Children.Add(mySys); x_TxtBox.Text = (int.Parse(x_TxtBox.Text) + 1).ToString();//改变当前x文本框的值 }
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); }