Esempio n. 1
0
 public void BindIt(BPAttachment ment)
 {
     this.HisBPAttachment         = ment;
     this.TB_No.Text              = ment.Name;
     this.TB_Name.Text            = ment.Label;
     this.TB_Exts.Text            = ment.Exts;
     this.TB_SaveTo.Text          = ment.SaveTo;
     this.CB_IsDelete.IsChecked   = ment.IsDelete;
     this.CB_IsDownload.IsChecked = ment.IsDownload;
     this.CB_IsUpload.IsChecked   = ment.IsUpload;
 }
Esempio n. 2
0
        void daSaveFile_SaveEnCompleted(object sender, FF.SaveEnCompletedEventArgs e)
        {
            if (e.Result.Contains("Err"))
            {
                MessageBox.Show(e.Result, "Error", MessageBoxButton.OK);
                return;
            }

            if (this.HisBPAttachment == null)
            {
                this.HisBPAttachment = new BPAttachment();
            }

            this.HisBPAttachment.Label      = this.TB_Name.Text;
            this.HisBPAttachment.Exts       = this.TB_Exts.Text;
            this.HisBPAttachment.IsDelete   = (bool)this.CB_IsDelete.IsChecked;
            this.HisBPAttachment.IsDownload = (bool)this.CB_IsDownload.IsChecked;
            this.HisBPAttachment.IsUpload   = (bool)this.CB_IsUpload.IsChecked;
            this.HisBPAttachment.SaveTo     = this.TB_SaveTo.Text;
            MessageBox.Show("保存成功.", "Save OK", MessageBoxButton.OK);
            this.DialogResult = true;
        }
Esempio n. 3
0
        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:
                this.SetValue(Canvas.TopProperty, y - 1);
                break;

            // 按 Down 键后 textBox 对象向 下 移动 1 个像素
            // Down 键所对应的 e.PlatformKeyCode == 40
            case Key.Down:
                this.SetValue(Canvas.TopProperty, y + 1);
                break;

            // 按 Left 键后 textBox 对象向 左 移动 1 个像素
            // Left 键所对应的 e.PlatformKeyCode == 37
            case Key.Left:
                this.SetValue(Canvas.LeftProperty, x - 1);
                break;

            // 按 Right 键后 textBox 对象向 右 移动 1 个像素
            // Right 键所对应的 e.PlatformKeyCode == 39
            case Key.Right:
                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)
                {
                    BPAttachment tb = new BPAttachment();
                    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);
        }