private void OKButton_Click(object sender, RoutedEventArgs e) { BPBtn btn = this.HisBtn; string keys = "@EnName=BP.Sys.FrmBtn@PKVal=" + btn.Name + "@FK_MapData=" + Glo.FK_MapData + "@Text=" + btn.Content.ToString() + "@DDL_AppType=" + (int)btn.HisBtnType + "@EventType=" + (int)btn.HisEventType + "@EventContext=" + this.TB_EventDoc.Text.Replace('@', '#') + "@MsgOK=" + this.TB_MsgOK.Text.Replace('@', '#') + "@MsgErr=" + this.TB_MsgErr.Text.Replace('@', '#'); FF.CCFormSoapClient da = Glo.GetCCFormSoapClientServiceInstance(); da.SaveEnAsync(keys); da.SaveEnCompleted += new EventHandler <FF.SaveEnCompletedEventArgs>(da_SaveEnCompleted); }
protected override void OnKeyDown(KeyEventArgs e) { e.Handled = true; // 获取 textBox 对象的相对于 Canvas 的 x坐标 和 y坐标 double x = (double)this.GetValue(Canvas.LeftProperty); double y = (double)this.GetValue(Canvas.TopProperty); // KeyEventArgs.Key - 与事件相关的键盘的按键 [System.Windows.Input.Key枚举] switch (e.Key) { // 按 Up 键后 textBox 对象向 上 移动 1 个像素 // Up 键所对应的 e.PlatformKeyCode == 38 // 当获得的 e.Key == Key.Unknown 时,可以使用 e.PlatformKeyCode 来确定用户所按的键 case Key.Up: case Key.W: this.SetValue(Canvas.TopProperty, y - 1); break; case Key.Down: case Key.S: this.SetValue(Canvas.TopProperty, y + 1); break; case Key.Left: case Key.A: this.SetValue(Canvas.LeftProperty, x - 1); break; case Key.Right: case Key.D: this.SetValue(Canvas.LeftProperty, x + 1); break; case Key.Delete: if (this.Name.Contains("_blank_") == false) { if (MessageBox.Show("您确定要删除吗?", "删除提示", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return; } } Canvas c = this.Parent as Canvas; c.Children.Remove(this); break; case Key.C: break; case Key.V: if (Keyboard.Modifiers == ModifierKeys.Control) { BPBtn tb = new BPBtn(); tb.Cursor = Cursors.Hand; tb.SetValue(Canvas.LeftProperty, (double)this.GetValue(Canvas.LeftProperty) + 15); tb.SetValue(Canvas.TopProperty, (double)this.GetValue(Canvas.TopProperty) + 15); Canvas s1c = this.Parent as Canvas; try { s1c.Children.Add(tb); } catch { s1c.Children.Remove(tb); } } break; default: break; } base.OnKeyDown(e); }