本文整理汇总了C#中System.Windows.Input.Cursor类的典型用法代码示例。如果您正苦于以下问题:C# Cursor类的具体用法?C# Cursor怎么用?C# Cursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cursor类属于System.Windows.Input命名空间,在下文中一共展示了Cursor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OverrideCursor
/// <summary>
/// Temporarily overrides mouse cursor for the entire application.
/// </summary>
/// <param name="newCursor">The new cursor to be used.</param>
/// <returns>The reference to the <see cref="System.IDisposable"/> object
/// restoring current mouse cursor upon call to the
/// <see cref="M:System.IDisposable.Dispose"/> method.</returns>
public static IDisposable OverrideCursor(Cursor newCursor)
{
var currentCursor = Mouse.OverrideCursor;
Mouse.OverrideCursor = newCursor;
return new DelegateDisposable(() => Mouse.OverrideCursor = currentCursor);
}
示例2: SetTemplate
public void SetTemplate(DataTemplate template)
{
if (template != null)
{
if (_cursorContainer != null)
{
var content = _cursorContainer.Child as ContentControl;
if (content != null)
{
content.ContentTemplate = template;
}
if (!_cursorContainer.IsOpen)
{
_element.MouseLeave += element_MouseLeave;
_element.MouseMove += element_MouseMove;
_cursorContainer.IsOpen = true;
_originalCursor = _element.Cursor;
_element.Cursor = Cursors.None;
}
}
}
else
{
_element.MouseLeave -= element_MouseLeave;
_element.MouseMove -= element_MouseMove;
_cursorContainer.IsOpen = false;
_element.Cursor = _originalCursor;
}
}
示例3: ShowStatusProgressbar
//in App Main Window stausbar
//Shows Progressbar in statusbar
private void ShowStatusProgressbar()
{
Window1 window = LifetimeService.Instance.Container.Resolve<Window1>();//27Oct2014
//window.ProgressStatusPanel.Visibility = Visibility.Visible;
defaultcursor = Mouse.OverrideCursor;
Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
}
示例4: MouseLeftButtonDown
/// <summary>
/// Override of <see cref="BehaviourBase"/> that handles a left mouse button press.
/// This initiates the point move process allowing a user to alter the Y value of
/// the selected point.
/// </summary>
/// <param name="position">The position on the mouse on click.</param>
public override void MouseLeftButtonDown(Point position)
{
// Get the point that has been clicked on.
GetSelectedPoint(position);
// Check we can capture the mouse, otherwise the move is impossible.
bool captured = BehaviourContainer.CaptureMouse();
if (captured && _selectedPoint != null)
{
_leftMouseDown = true;
SetZoomEnabled(false);
foreach(var child in this.BehaviourContainer.Children)
{
if(child is ZoomBehaviour)
{
(child as ZoomBehaviour).IsEnabled = false;
break;
}
}
// Change the point style by adding it to the Series SelectedItems list
//((ChartSingleSeriesBase)Chart.Series[0]).SelectedItems.Add(_selectedPoint);
// Change the cursor
_currentCursor = Chart.Cursor;
Chart.Cursor = Cursors.Hand;
}
}
示例5: MapAction
/// <summary>${ui_action_MapAction_constructor_Map_D}</summary>
/// <param name="map">${ui_action_MapAction_constructor_Map_param_map}</param>
/// <param name="name">${ui_action_MapAction_constructor_Map_param_name}</param>
/// <param name="cursor">${ui_action_MapAction_constructor_Map_param_cursor}</param>
protected MapAction(Map map, string name, Cursor cursor)
{
Name = name;
Map = map;
Map.Cursor = cursor;
Map.Focus();
}
示例6: OverrideCursor
public OverrideCursor(Cursor changeToCursor)
{
_stack.Push(changeToCursor);
if (Mouse.OverrideCursor != changeToCursor) {
Mouse.OverrideCursor = changeToCursor;
}
}
示例7: BuildAdornerCorner
private Thumb BuildAdornerCorner(Cursor cursor, DragDeltaEventHandler dragHandler)
{
var thumb = new Thumb();
// TODO: this thumb should be styled to look like a dotted triangle,
// similar to the one you can see on the bottom right corner of
// Internet Explorer window
thumb.Cursor = cursor;
thumb.Height = thumb.Width = 10;
thumb.Opacity = 0.40;
thumb.Background = new SolidColorBrush(Colors.MediumBlue);
thumb.DragDelta += dragHandler;
thumb.DragStarted += (s, e) => {
var handler = ResizeStarted;
if (handler != null) {
handler(this, e);
}
};
thumb.DragCompleted += (s, e) => {
var handler = ResizeCompleted;
if (handler != null) {
handler(this, e);
}
};
_visualChildren.Add(thumb);
return thumb;
}
示例8: PreprocessMouseDown
public override void PreprocessMouseDown(MouseButtonEventArgs e)
{
if (SettingsProvider.IsMiddleClickScrollEnabled() == false)
return;
if (this._location.HasValue)
{
this.StopScrolling();
e.Handled = true;
}
else
{
if (e.ChangedButton != MouseButton.Middle || this._view.IsClosed || (!this._view.VisualElement.IsVisible || !this._view.VisualElement.CaptureMouse()))
return;
this._oldCursor = this._view.VisualElement.Cursor;
this._view.VisualElement.Cursor = Cursors.ScrollAll;
Point position = e.GetPosition((IInputElement)this._view.VisualElement);
this._location = new Point?(this._view.VisualElement.PointToScreen(position));
if (this._zeroPointImage == null)
{
BitmapSource bitmapSourceFromHicon = Imaging.CreateBitmapSourceFromHIcon(User32.LoadImage(IntPtr.Zero, new IntPtr(32654), 2U, 0, 0, 40960U), Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
bitmapSourceFromHicon.Freeze();
this._zeroPointImage = new Image();
this._zeroPointImage.Source = (ImageSource)bitmapSourceFromHicon;
this._zeroPointImage.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
this._zeroPointImage.Opacity = 0.5;
}
Canvas.SetLeft((UIElement)this._zeroPointImage, this._view.ViewportLeft + position.X - this._zeroPointImage.DesiredSize.Width * 0.5);
Canvas.SetTop((UIElement)this._zeroPointImage, this._view.ViewportTop + position.Y - this._zeroPointImage.DesiredSize.Height * 0.5);
this._layer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, new SnapshotSpan?(), (object)null, (UIElement)this._zeroPointImage, (AdornmentRemovedCallback)null);
this._lastMoveTime = DateTime.Now;
this._moveTimer = new DispatcherTimer(new TimeSpan(0, 0, 0, 0, 25), DispatcherPriority.Normal, new EventHandler(this.OnTimerElapsed), this._view.VisualElement.Dispatcher);
this._dismissOnMouseUp = false;
e.Handled = true;
}
}
示例9: SoheilSingularView
public SoheilSingularView(ISingularList viewModel, List<Tuple<string, AccessType>> accessList, Cursor openCursor, Cursor closeCursor)
{
InitializeComponent();
ViewModel = viewModel;
AccessList = accessList;
_openCursor = openCursor;
_closeCursor = closeCursor;
}
示例10: dragWindow
void dragWindow(object sender, MouseButtonEventArgs e)
{
//Change cursor
Cursor closedhand = new Cursor(new System.IO.MemoryStream(ArduinoMonitor.Resources.closedhand));
dragBar.Cursor = closedhand;
this.DragMove();
}
示例11: PolygonWaveFormControl
public PolygonWaveFormControl()
{
this.SizeChanged += OnSizeChanged;
InitializeComponent();
XScale = 2;
defaultCursor = Cursor;
this.DataContext = this;
}
示例12: CursorSwitcher
public CursorSwitcher(Cursor cursor)
{
_previousCursor =Mouse.OverrideCursor ;
if ( cursor == null )
Mouse.OverrideCursor =Cursors.Wait ;
else
Mouse.OverrideCursor =cursor ;
}
示例13: WordView
public WordView()
{
InitializeComponent();
ListBox.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler((sender, args) => args.Handled = false), true);
StreamResourceInfo closedhand = System.Windows.Application.GetResourceStream(new Uri("Images/closedhand.cur", UriKind.Relative));
Debug.Assert(closedhand != null);
_closedHandCursor = new Cursor(closedhand.Stream);
}
示例14: button4_Click
private void button4_Click(object sender, RoutedEventArgs e)
{
// 현재는 오류남
// x2c2.ani를 프로젝트에 추가하고, 빌드작업을 resource로 설정
// 12장 참고
StreamResourceInfo sri = Application.GetContentStream(new Uri("x2c2.ani", UriKind.Relative));
Cursor customerCursor = new Cursor(sri.Stream);
this.Cursor = customerCursor;
}
示例15: OverrideCursor
public OverrideCursor(Cursor changetoCursor)
{
_stack.Push(changetoCursor);
if (changetoCursor != null && Mouse.OverrideCursor != changetoCursor)
{
Mouse.OverrideCursor = changetoCursor;
}
}