using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MuchInfo.Chart.WPF.Controls.QuickTimeSpan { public partial class QuickTimeSpan : UserControl { private Chart _chart; public QuickTimeSpan(Chart chart) { InitializeComponent(); this._chart = chart; } private void qtsListBox_PreviewKeyDown(object sender, KeyEventArgs e) { //鼠标上键 if (Keyboard.IsKeyDown(Key.Up)) { _chart._crossHairGrid_IsDoubleClick = false; _chart.HiddenCrossHairGrid(); if (_chart.RecordCount + _chart.LeftRightKeyToAcceleration < _chart.MaxRecordCount) { _chart.RecordCount += _chart.LeftRightKeyToAcceleration; } else { _chart.RecordCount = _chart.MaxRecordCount; } } //鼠标下键 if (Keyboard.IsKeyDown(Key.Down)) { _chart._crossHairGrid_IsDoubleClick = false; _chart.HiddenCrossHairGrid(); if (_chart.RecordCount - _chart.LeftRightKeyToAcceleration > _chart.MinRecordCount) { _chart.RecordCount -= _chart.LeftRightKeyToAcceleration; } else { _chart.RecordCount = _chart.MinRecordCount; } } //鼠标左键 if (Keyboard.IsKeyDown(Key.Left)) { Mouse.OverrideCursor = Cursors.None; _chart.DrawingCross(false); } //鼠标右键 if (Keyboard.IsKeyDown(Key.Right)) { Mouse.OverrideCursor = Cursors.None; _chart.DrawingCross(true); } e.Handled = true; } } }