本文整理汇总了C#中System.Windows.Input.MouseEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# MouseEventArgs类的具体用法?C# MouseEventArgs怎么用?C# MouseEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MouseEventArgs类属于System.Windows.Input命名空间,在下文中一共展示了MouseEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mouseZone_MouseMove
void mouseZone_MouseMove(object sender, MouseEventArgs e)
{
if (IsActive)
{
_viewport.Cursor = Cursors.None;
var centerOfViewport = _viewport.PointToScreen(new Point(_viewport.ActualWidth / 2, _viewport.ActualHeight / 2));
var relativePos = e.MouseDevice.GetPosition(_viewport);
var actualRelativePos = new Point(relativePos.X - _viewport.ActualWidth / 2, _viewport.ActualHeight / 2 - relativePos.Y);
var dx = actualRelativePos.X;
var dy = actualRelativePos.Y;
_yaw += dx;
_pitch += dy;
// Rotate
Rotation = QuaternionHelper.EulerAnglesInDegToQuaternion(_pitch * Sensitivity * 0.1, _yaw * Sensitivity * 0.1, 0);
// Set mouse position back to the center of the viewport in screen coordinates
MouseUtilities.SetPosition(centerOfViewport);
}
else
{
_viewport.Cursor = Cursors.Arrow;
}
}
示例2: Slider_OnMouseMove
private void Slider_OnMouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
ui.ViewModel.WorkspaceViewModel.HasUnsavedChanges = true;
}
}
示例3: myPath_MouseDown
private void myPath_MouseDown(object sender, MouseEventArgs e)
{
mouseVerticalPosition = e.GetPosition(scene).Y;
mouseHorizontalPosition = e.GetPosition(scene).X;
isDragging = true;
((Path)sender).CaptureMouse();
}
示例4: OnMiddleMouseLeave
void OnMiddleMouseLeave(object sender, MouseEventArgs e)
{
if (e.MiddleButton == MouseButtonState.Pressed)
{
MiddleButtonScrollHelper.StopScrolling();
}
}
示例5: ListViewItem_MouseLeave
public void ListViewItem_MouseLeave(object sender, MouseEventArgs e)
{
ListViewItem listViewItem = (ListViewItem)sender;
MoveScore moveScore = (MoveScore)listViewItem.Content;
var viewModel = DataContext as MainViewModel;
viewModel.UnhighlightMove(moveScore.Move);
}
示例6: OnThrottledMouseMove
/// <summary>
/// Raises the ThrottledMouseMove event
/// </summary>
protected void OnThrottledMouseMove(MouseEventArgs args)
{
if (ThrottledMouseMove != null)
{
ThrottledMouseMove(_element, args);
}
}
示例7: DoubleClickHandler
public void DoubleClickHandler(object sender, MouseEventArgs e)
{
var selectedTraining = sender as ListBoxItem;
var training = (Training)selectedTraining.DataContext;
trainingSelectedEvent(training);
}
示例8: OnMouseMove
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
// if mouse button is not pressed we have no drag operation, ...
if (e.LeftButton != MouseButtonState.Pressed)
this.rubberbandSelectionStartPoint = null;
// ... but if mouse button is pressed and start
// point value is set we do have one
if (this.rubberbandSelectionStartPoint.HasValue)
{
// create rubberband adorner
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
{
RubberbandAdorner adorner = new RubberbandAdorner(this, rubberbandSelectionStartPoint);
if (adorner != null)
{
adornerLayer.Add(adorner);
}
}
}
e.Handled = true;
}
示例9: Button_MouseEnter
private void Button_MouseEnter(object sender, MouseEventArgs e)
{
if (((Button)sender).Content != null)
{
((Button)sender).Background = App.Current.Resources["PhoneBorderBrush"] as SolidColorBrush;
}
}
示例10: Grip_MouseMove
private void Grip_MouseMove(object sender, MouseEventArgs e)
{
if (Grip.IsMouseCaptured)
{
this.Height = e.GetPosition(this).Y;
}
}
示例11: OnMouseMove
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.LeftButton != MouseButtonState.Pressed)
this.dragStartPoint = null;
if (this.dragStartPoint.HasValue)
{
// XamlWriter.Save() has limitations in exactly what is serialized,
// see SDK documentation; short term solution only;
string xamlString = XamlWriter.Save(this.Content);
DragObject dataObject = new DragObject();
dataObject.Xaml = xamlString;
WrapPanel panel = VisualTreeHelper.GetParent(this) as WrapPanel;
if (panel != null)
{
// desired size for DesignerCanvas is the stretched Toolbox item size
double scale = 1.3;
dataObject.DesiredSize = new Size(panel.ItemWidth * scale, panel.ItemHeight * scale);
}
DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy);
e.Handled = true;
}
}
示例12: OnGridPreviewMouseMove
private void OnGridPreviewMouseMove(object sender, MouseEventArgs e)
{
if (CheckIgnoreGridMove.IsChecked == true && !IsButton1Source(e)) return;
ShowStatus(nameof(OnGridPreviewMouseMove), e);
e.Handled = CheckStopPreview.IsChecked == true;
}
示例13: contentView_PreviewMouseMove
private void contentView_PreviewMouseMove(object sender, MouseEventArgs e)
{
var senderObj = sender as ScoreboardControl;
if (senderObj == null)
{
// This shouldn't happen.
return;
}
// Get the current mouse position
Point mousePos = e.GetPosition(null);
Vector diff = this.startPoint - mousePos;
if (e.LeftButton == MouseButtonState.Pressed &&
(Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
{
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "starboard.xbs");
if (File.Exists(path) == false)
{
return;
}
var strCol = new StringCollection { path };
var o = new DataObject(DataFormats.FileDrop, strCol);
o.SetFileDropList(strCol);
DragDrop.DoDragDrop(senderObj, o, DragDropEffects.Copy);
}
}
示例14: OpenOperationEditWindow
public void OpenOperationEditWindow(object sender, MouseEventArgs args)
{
if (OperationStopwatch != null && OperationStopwatch.ElapsedMilliseconds > 600)
{
operationCount = 0;
}
if (operationCount == 0)
{
OperationStopwatch = Stopwatch.StartNew();
operationCount++;
}
else if (operationCount == 1)
{
int elapsedMilliseconds = (int)OperationStopwatch.ElapsedMilliseconds;
operationCount = 0;
if (elapsedMilliseconds <= (int)GetDoubleClickTime())
{
TextBlock textBlock = sender as TextBlock;
ITestItemViewModel testItemViewModel = textBlock.DataContext as ITestItemViewModel;
ICommand editOperationCommand = testItemViewModel.EditOperationCommand;
editOperationCommand.Execute(null);
}
}
}
示例15: txbConfig_MouseEnter
private void txbConfig_MouseEnter(object sender, MouseEventArgs e)
{
_descripcion =
"Cambia el nombre de concurso, las cápsulas informativas, carga los equipos a concursar y las preguntas a usar; la cantidad de tiempo por pregunta y el número de ellas por ronda";
txbDescripcion.Text = _descripcion;
//imgPreview.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\config.png"));
}