public void MainWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.T) //Transform { List <BriefElecComp> A = GetAllComp(); SimplifiedPic simplifiedPic = new SimplifiedPic(A, this); } else if (e.Key == Key.I) { MessageBox.Show(elecCompSet.ToString()); } else if (e.Key == Key.R && elecCompSet.pressedElecComp != null) { //MessageBox.Show("Rotating!"); elecCompSet.pressedElecComp.RotateLeft(); } else if (e.Key == Key.D && elecCompSet.pressedElecComp != null) { if (elecCompSet.pressedElecComp.IsWire) { elecCompSet.pressedElecComp.State = ElecComp.State_AdjRight; } } else if (e.Key == Key.S) { LayoutRecord.Save(elecCompSet); } if (e.Key == Key.O) { /*List<BriefElecComp> A = GetAllComp(); * String str = ""; * foreach (BriefElecComp b in A) * { * str += b + "\n"; * } * MessageBox.Show(str); //之前写的演示用的,注释掉,现在是打开文件*/ LayoutRecord.Read(elecCompSet, Mycanvas); } if (e.Key == Key.C) { OnClosing(); } }
private void MainWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.T) //Transform { List <BriefElecComp> A = GetAllComp(); SimplifiedPic simplifiedPic = new SimplifiedPic(A, this); } if (e.Key == Key.O) { List <BriefElecComp> A = GetAllComp(); String str = ""; foreach (BriefElecComp b in A) { str += b + "\n"; } MessageBox.Show(str); } else if (e.Key == Key.I) { MessageBox.Show(elecCompSet.ToString()); } else if (e.Key == Key.R && elecCompSet.pressedElecComp != null) { //MessageBox.Show("Rotating!"); elecCompSet.pressedElecComp.RotateLeft(); } else if (e.Key == Key.D && elecCompSet.pressedElecComp != null) { if (elecCompSet.pressedElecComp.IsWire) { elecCompSet.pressedElecComp.State = ElecComp.State_AdjRight; } } else if (e.Key == Key.S && elecCompSet.pressedElecComp != null) { elecCompSet.pressedElecComp.State = ElecComp.State_Move; } }