private void innerFrame_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Right)
            {
                return;
            }
            m_isMouseDown = true;
            Point location = e.GetPosition(innerFrame);

            if (Math.Abs(location.X - HightLightRect.X) < 13)
            {
                location.X  = HightLightRect.X;
                m_editMode |= 0x1000;
            }
            else if (Math.Abs(location.X - HightLightRect.X - HightLightRect.Width) < 13)
            {
                location.X  = HightLightRect.X + HightLightRect.Width;
                m_editMode |= 0x0010;
            }
            if (Math.Abs(location.Y - HightLightRect.Y) < 13)
            {
                location.Y  = HightLightRect.Y;
                m_editMode |= 0x0100;
            }
            else if (Math.Abs(location.Y - HightLightRect.Y - HightLightRect.Height) < 13)
            {
                location.Y  = HightLightRect.Y + HightLightRect.Height;
                m_editMode |= 0x0001;
            }
            ScreenHelper.SetMousePos((int)location.X, (int)location.Y);
            ((UIElement)sender).CaptureMouse();
            InnerFrameMode = 3;
            m_lastPoint    = location;
            //e.Handled = true;
        }
        private void TextBlockFrame_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.Hide();
            BitmapImage bitmapSource = ConvertHelper.ToBitmapImage(ScreenHelper.CaptureInternal(new System.Drawing.Rectangle((int)(this.Left + m_thickness), (int)(this.Top + m_thickness), (int)(this.Width - m_thickness * 2), (int)(this.Height - m_thickness * 2))));

            imageList.Add(bitmapSource);
            ClipImage();

            this.Show();
        }
        public ScreenSelectWindow()
        {
            InitializeComponent();
            this.Width  = SystemParameters.PrimaryScreenWidth;
            this.Height = SystemParameters.PrimaryScreenHeight;
            this.Left   = this.Top = 0;

            BackgroundImg.Source = ConvertHelper.ToBitmapImage(ScreenHelper.CaptureFullScreen());


            BitmapSource img    = ((BitmapSource)BackgroundImg.Source);
            int          stride = img.PixelWidth * 4;
            int          size   = img.PixelHeight * stride;

            m_pixels = new byte[size];
            img.CopyPixels(m_pixels, stride, 0);

            SetDrawTool();

            // 注册撤销与重做命令
            CommandManager.RegisterClassCommandBinding(typeof(ScreenSelectWindow), new CommandBinding(ApplicationCommands.Redo, RedoCommand_Executed));
            CommandManager.RegisterClassCommandBinding(typeof(ScreenSelectWindow), new CommandBinding(ApplicationCommands.Undo, UndoCommand_Executed, UndoCommand_CanExecute));
            CommandManager.RegisterClassCommandBinding(typeof(ScreenSelectWindow), new CommandBinding(ApplicationCommands.Close, CloseCommand_Executed));
            CommandManager.RegisterClassInputBinding(typeof(ScreenSelectWindow), new KeyBinding(ApplicationCommands.Close, new KeyGesture(Key.Escape)));


            //  绑定事件
            imageEditTool.AddHandler(ImageEditTool.SelectedColorChagnedEvent, new RoutedEventHandler(PenColorChanged));
            imageEditTool.AddHandler(ImageEditTool.SelectedSizeChagnedEvent, new RoutedEventHandler(PenSizeChanged));
            imageEditTool.AddHandler(ImageEditTool.DrawModeStyleChangedEvent, new RoutedEventHandler(DrawModeStyleChanged));
            imageEditTool.AddHandler(ImageEditTool.OkBtnClickEvent, new RoutedEventHandler(ToolOkBtnClick));
            imageEditTool.AddHandler(ImageEditTool.CancelBtnClickEvent, new RoutedEventHandler(ToolCancelBtnClick));
            imageEditTool.AddHandler(ImageEditTool.TopBtnClickEvent, new RoutedEventHandler(ToolTopBtnClick));
            imageEditTool.AddHandler(ImageEditTool.LongScreenBtnClickEvent, new RoutedEventHandler(ToolLongScreenBtnClick));
            imageEditTool.AddHandler(ImageEditTool.RecordBtnClickEvent, new RoutedEventHandler(ToolRecordBtnClick));
        }