private void buttonToFtpCheck_Click(object sender, RoutedEventArgs e) { System.Windows.Input.Cursor oldCursor = Mouse.OverrideCursor; try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; ServiceFtp ftp = new ServiceFtp(textBoxToFtpUser.Text, passwordBoxToFtpPw.Password, 5000, textBoxToFtpUri.Text); if (ftp.UriPathExist() == true) { Mouse.OverrideCursor = oldCursor; MessageBox.Show(this, "FTP Check OK"); } else { Mouse.OverrideCursor = oldCursor; MessageBox.Show(this, "FTP Check Fail!"); } } catch (Exception ex) { Mouse.OverrideCursor = oldCursor; MessageBox.Show(this, "FTP Check Fail!, " + ex.Message); } }
/// <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); }
//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; }
protected void SetCursor([CanBeNull] Cursor cursor) { if (cursor != null) { Cursor = cursor; } }
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; }
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; } }
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == 24 && (int)lParam == 3 && base.Visibility != System.Windows.Visibility.Visible) { handled = true; } if (msg == 33) { handled = true; return(new IntPtr(3)); } if (msg == 513) { Point point = new Point((double)((int)lParam & 65535), (double)((int)lParam >> 16 & 65535)); NativeMethods.PostMessage(this.ownerHandle, 161, (IntPtr)this.getHitTestValue(point), IntPtr.Zero); } if (msg == 132) { Point point1 = new Point((double)((int)lParam & 65535), (double)((int)lParam >> 16 & 65535)); Point point2 = base.PointFromScreen(point1); System.Windows.Input.Cursor cursor = this.getCursor(point2); if (cursor != base.Cursor) { base.Cursor = cursor; } } return(IntPtr.Zero); }
/// <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(); }
/// <summary> /// Open a log folder. /// </summary> /// <param name="uri">path to a log folder.</param> private static void UseShellExecute(string path) { // Switch the wait cursor since shellexec can take a second or so. System.Windows.Input.Cursor cursor = WixBA.View.Cursor; WixBA.View.Cursor = System.Windows.Input.Cursors.Wait; Process process = null; try { process = new Process(); process.StartInfo.FileName = path; process.StartInfo.UseShellExecute = true; process.StartInfo.Verb = "open"; process.Start(); } finally { if (null != process) { process.Dispose(); } // back to the original cursor. WixBA.View.Cursor = cursor; } }
public OverrideCursor(Cursor changeToCursor) { _stack.Push(changeToCursor); if (Mouse.OverrideCursor != changeToCursor) { Mouse.OverrideCursor = changeToCursor; } }
public NewGameAdd() { string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new System.Windows.Input.Cursor(data1); this.Cursor = cursor; this.Title = "Maets"; InitializeComponent(); modelProducts = new List <ModelImage>(); btnAdd.Content = "Отправить заявку\n на добаление"; ModelImage modelProduct = new ModelImage(); modelProducts.Add(modelProduct.MakeModelImage(File.ReadAllBytes(ShopWindows.imagesmaets + @"1.encr"))); Screenshoot.Items.Add(modelProducts[0]); Screenshoot1.Items.Add(modelProducts[0]); Screenshoot2.Items.Add(modelProducts[0]); Screenshoot3.Items.Add(modelProducts[0]); Screenshoot4.Items.Add(modelProducts[0]); Screenshoot5.Items.Add(modelProducts[0]); Screenshoot1.IsEnabled = false; Screenshoot2.IsEnabled = false; Screenshoot3.IsEnabled = false; Screenshoot4.IsEnabled = false; Screenshoot5.IsEnabled = false; }
public static void SafeOverrideCursor(System.Windows.Input.Cursor cursor) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { Mouse.OverrideCursor = cursor; })); }
private void InitializeCamera() { System.Windows.Input.Cursor originalCursor = this.Cursor; try { this.Cursor = Cursors.Wait; this.initializing = true; CommandManager.InvalidateRequerySuggested(); this.CloseCamera(); this.camera = new PhotoBoothCamera(); if (this.camera.Initialize()) { this.cameraSettingsGrid.DataContext = this.camera.Camera; } else { MessageBox.Show(this.camera.InitializationLog); this.CloseCamera(); } } catch (Exception ex) { MessageBox.Show("Caught an exception during camera initialization: " + ex.Message); } finally { this.initializing = false; CommandManager.InvalidateRequerySuggested(); this.Cursor = originalCursor; } }
private static System.Windows.Input.Cursor LoadCursor(String filename) { var stream = Application.GetResourceStream(new Uri("Images/cursors/" + filename, UriKind.Relative)).Stream; var cursor = new System.Windows.Input.Cursor(stream); return(cursor); }
/// <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; } }
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; } }
/// <summary> /// 鼠标按下准备拖动歌词 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CanvasLyric_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { System.Windows.Input.Cursor csB = new System.Windows.Input.Cursor(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\cursor\\hand-close.cur"); this.Cursor = csB; } catch { } LyricShow.pauseOrContinueLyricShow(true);//暂停歌词秀,然后拖动 DragBeforeLyricTime = player.Position.TotalSeconds; DragAfterLyricTime = DragBeforeLyricTime; IsStartDragLyric = true; LyricPointA.X = e.GetPosition(this).X; LyricPointA.Y = e.GetPosition(this).Y; LyricPointB.X = e.GetPosition(this).X; LyricPointB.Y = e.GetPosition(this).Y; BaseLine.Visibility = Visibility.Visible; tbDragTime.Visibility = Visibility.Visible; try { tbDragTime.Text = string.Format("{0}:{1}", player.Position.Minutes, player.Position.Seconds); } catch { IsStartDragLyric = false; tbDragTime.Text = "0:00.00"; } }
public SoheilSingularView(ISingularList viewModel, List<Tuple<string, AccessType>> accessList, Cursor openCursor, Cursor closeCursor) { InitializeComponent(); ViewModel = viewModel; AccessList = accessList; _openCursor = openCursor; _closeCursor = closeCursor; }
public PolygonWaveFormControl() { this.SizeChanged += OnSizeChanged; InitializeComponent(); XScale = 2; defaultCursor = Cursor; this.DataContext = this; }
public CursorSwitcher(Cursor cursor) { _previousCursor =Mouse.OverrideCursor ; if ( cursor == null ) Mouse.OverrideCursor =Cursors.Wait ; else Mouse.OverrideCursor =cursor ; }
void dragWindow(object sender, MouseButtonEventArgs e) { //Change cursor Cursor closedhand = new Cursor(new System.IO.MemoryStream(ArduinoMonitor.Resources.closedhand)); dragBar.Cursor = closedhand; this.DragMove(); }
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); }
public Crosshair() { InitializeComponent(); // dragger.Source = imgCrosshair; using (MemoryStream memStream = new MemoryStream(Properties.Resources.crosshair)) { myCursor = new System.Windows.Input.Cursor(memStream); } }
/// <summary> /// 鼠标进入歌词面板 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CanvasLyric_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { try { System.Windows.Input.Cursor csA = new System.Windows.Input.Cursor(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\cursor\\hand-open.cur"); this.Cursor = csA; } catch { } }
public OverrideCursor(Cursor changetoCursor) { _stack.Push(changetoCursor); if (changetoCursor != null && Mouse.OverrideCursor != changetoCursor) { Mouse.OverrideCursor = changetoCursor; } }
public PresenterItem(ElementBase element) : base(element) { Cursor = null; ShowBorderOnMouseOver = false; IsEnabled = true; IsPoint = false; IsVisibleLayout = !element.IsHidden; }
public MainWindow() { InitializeComponent(); var curPath = Path.Combine(Environment.CurrentDirectory, "crayon.cur"); var cursor = new Cursor(curPath); blkTop.Background = _background; icvMain.Background = _background; icvMain.Cursor = cursor; }
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; }
public WaitCursor() { Application.Current.Dispatcher.Invoke(() => { _previousCursor = Mouse.OverrideCursor; Mouse.OverrideCursor = Cursors.Wait; InstanceCounter++; }); }
/// <summary> /// Converts between a System.Windows.Input.Cursor and a System.Windows.Forms.Cursor /// </summary> internal static SWF.Cursor ToSystemWindowsFormsCursor(SWI.Cursor swiCursor) { SWF.Cursor swfCursor; if (swiCursor != null && ToSystemWindowsFormsCursorDictionary.TryGetValue(swiCursor, out swfCursor)) { return(swfCursor); } return(SWF.Cursors.Default); }
public ShopWindows(string Login, string Password) { this.Title = "Maets"; string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new System.Windows.Input.Cursor(data1); this.Cursor = cursor; this.Title = "Maets"; client = new WCFServiceClient(new System.ServiceModel.InstanceContext(new CallbackClass(this)), "NetTcpBinding_IWCFService"); client.Connect(Login, Password); profile = client.ActiveProfile(Login, Password); if (profile != null) { products = client.GetProductTable().ToList(); profilesq = client.GetAllUsers().ToList(); InitializeComponent(); Loaded += Window_Loaded; Onlyforadmin.Visibility = Visibility.Hidden; if (profile.AccessRight >= 3) { productsmoderation = client.GetModerationProduct(profile.ID).ToList(); for (int i = 0; i < productsmoderation.Count; i++) { Moderationproduct.Items.Add(productsmoderation[i]); // listuser.Items.Add(i); } Onlyforadmin.Visibility = Visibility.Visible; //if(profile.AccessRight==4) //{ // listuser.ItemsSource = products; // for(idxg=1;idxg<5;idxg++) // { // // listrigth; // } //} if (profile.AccessRight >= 2) { AddGame.Visibility = Visibility.Visible; } } foreach (Service.Product p in profile.Games.ToList()) { mylibrary.Items.Add(p); } } else { throw new Exception("Ошибка подключения"); } }
public WindowFinder() { InitializeComponent(); _crosshairsCursor = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Snoop.Resources.SnoopCrosshairsCursor.cur")); PreviewMouseLeftButtonDown += WindowFinderMouseLeftButtonDown; MouseMove += WindowFinderMouseMove; MouseLeftButtonUp += WindowFinderMouseLeftButtonUp; }
public MainWindow() { InitializeComponent(); if (string.IsNullOrEmpty(Path)) return; txt_Directory.Text = Path; _originalMediaMargin = media.Margin; _originalBackground = Background; _originalCursor = Cursor; Reset(); }
private void min_Click(object sender, RoutedEventArgs e)//鼠标改变方法 { count++; string b = ""; Random random = new Random(); int a = random.Next(1, 17); if (count == 50) { Appgame ag = new Appgame(); ag.Show(); } if ((count % 3) == 0) { switch (a) { case 1: b = "working.ani"; break; case 2: b = "App (7).ani"; break; case 3: b = "58.ani"; break; case 4: b = "AppStarting.cur"; break; case 5: b = "11.cur"; break; case 6: b = "12.ani"; break; case 7: b = "13.cur"; break; case 8: b = "14.cur"; break; case 9: b = "21.ani"; break; case 10: b = "Ultra_AppStarting.ani"; break; case 11: b = "Ultra_Arrow.ani"; break; case 12: b = "51.ani"; break; case 13: b = "52.ani"; break; case 14: b = "53.ani"; break; case 15: b = "App (10).ani"; break; case 16: b = "Ultra_IBeam.ani"; break; default: b = "uperleft.cur"; break; } System.Windows.Input.Cursor cur = new System.Windows.Input.Cursor(System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "ani", b)); this.Cursor = cur; } }
//Shows Progressbar private void ShowProgressbar() { //bw = new DatasetLoadingBusyWindow("Please wait while Dataset is Loading..."); //bw.Owner = (Application.Current.MainWindow); //bw.WindowStartupLocation = WindowStartupLocation.CenterOwner; //bw.Visibility = Visibility.Visible; //bw.Show(); //bw.Activate(); defaultcursor = Mouse.OverrideCursor; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; }
private void button3_Click(object sender, RoutedEventArgs e) { // 파일을 프로젝트에 추가하고, 빌드작업:없음, 출력디렉토리 복사 "항상복사"로 변경 string temp = AppDomain.CurrentDomain.BaseDirectory + "stopwatch.ani"; Cursor customerCursor = new Cursor( temp); //Path.Combine(ApplitionDir, "stopwatch.ani")); this.Cursor = customerCursor; }
/// <summary> /// Constructor : crée un WaitCursor et affiche le curseur d'attente. /// </summary> /// <param name="typeDeCurseur">Type de curseur à afficher</param> public WaitCursor(Cursor typeDeCurseur) { lock (lockObject) { if (compteur == 0) { DisplayWaitingCursor(typeDeCurseur); } compteur++; } }
/// <param name="sizeChangeCtrl">マウス入力によってサイズが変更されるコントロール</param> /// <param name="sizeChangeArea">上下左右のサイズ変更が有効になる範囲を指定</param> /// <param name="sizeChangeAreaWidth">サイズ変更が有効になる範囲の幅を指定</param> public DAndDSizeChanger(FrameworkElement sizeChangeCtrl, DAndDArea sizeChangeArea, int sizeChangeAreaWidth) { this.sizeChangeCtrl = sizeChangeCtrl; this.sizeChangeAreaWidth = sizeChangeAreaWidth; this.sizeChangeArea = sizeChangeArea; defaultCursor = sizeChangeCtrl.Cursor; sizeChangeCtrl.MouseMove += new MouseEventHandler(sizeChangeCtrl_MouseMove); sizeChangeCtrl.MouseDown += new MouseButtonEventHandler(sizeChangeCtrl_MouseDown); sizeChangeCtrl.MouseUp += new MouseButtonEventHandler(sizeChangeCtrl_MouseUp); }
public static Cursor generateCursor(DrawingAttributes pen) { using (DdMonitor.Lock(lockObject)) { if (pen == previousPen) return previousCursor; var color = System.Drawing.Color.FromArgb(pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B); previousPen = pen; previousCursor = CursorHelper.CreateCursor((int)pen.Width, (int)pen.Height, color, (int)(pen.Width / 2), (int)(pen.Height / 2)); return previousCursor; } }
/// <summary> /// 繁忙状态 /// </summary> /// <param name="statusText">工作時提供信息</param> /// <param name="status">視圖狀態</param> /// <param name="endStatusText">工作完成時提供信息</param> /// <param name="token"></param> public StatusBusy(string statusText, ViewStatus status, string endStatusText = null) { m_ViewStatus = status; m_StatusText = endStatusText; m_Cursor = status.Cursor; //修改當前ViewModel的狀態,再發消息通知主窗口 status.StatusText = statusText; status.Cursor = Cursors.Wait; status.IsBusy = true; RuntimeContext.Service.Messenger.Send(new GenericMessage<ViewStatus>(status)); System.Windows.Application.Current.Dispatcher.DoEvent(); }
public void SetMapCursorSet1() { var zoomInCursor = new System.Windows.Input.Cursor(Application.GetResourceStream(new Uri("/IRI.Jab.Common;component/Assets/Cursors/MapCursorSet1/MagnifyPlusRightHanded.cur", UriKind.Relative)).Stream, false); this.SetDefaultCursor(IRI.Jab.Common.Model.MapAction.ZoomInRectangle, zoomInCursor); this.SetDefaultCursor(IRI.Jab.Common.Model.MapAction.ZoomIn, zoomInCursor); var zoomOutCursor = new System.Windows.Input.Cursor(Application.GetResourceStream(new Uri("/IRI.Jab.Common;component/Assets/Cursors/MapCursorSet1/MagnifyMinusRightHanded.cur", UriKind.Relative)).Stream, false); this.SetDefaultCursor(IRI.Jab.Common.Model.MapAction.ZoomOutRectangle, zoomOutCursor); this.SetDefaultCursor(IRI.Jab.Common.Model.MapAction.ZoomOut, zoomOutCursor); }
private void btnQuery_Click(object sender, RoutedEventArgs e) { var worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(DoImportPages); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnCompletedImport); this.curBackingStore = Mouse.OverrideCursor; Mouse.OverrideCursor = Cursors.Wait; ImageProcessing.SetImage(this.canvasMain, MainWindow.posLoadingGif, this.gifLoading.FrameImage); worker.RunWorkerAsync(); }
/// <summary> /// Auxilliary method for creating thumbs /// </summary> /// <param name="position">Thumb position in the window</param> /// <returns>Returns created WindowThumb</returns> WindowThumb CreateThumb(Position position, Cursor cursor) { WindowThumb thumb = new WindowThumb(); thumb.Position = position; thumb.DragStarted += new DragStartedEventHandler(Thumb_DragStarted); thumb.DragDelta += new DragDeltaEventHandler(Thumb_DragDelta); thumb.Cursor = cursor; visualChildren.Add(thumb); return thumb; }
public MeasureDistance(Map map, Cursor cursor) { Name = "MeasureDistance"; Map = map; Stroke = new SolidColorBrush(Colors.Red); StrokeThickness = 3; Opacity = 1; Map.Cursor = cursor; measureFinallyResult = new TextBlock(); measureFinallyResult.FontWeight = FontWeights.ExtraBlack; }
public MainWindow() { InitializeComponent(); if (string.IsNullOrEmpty(Path)) { return; } txt_Directory.Text = Path; _originalMediaMargin = media.Margin; _originalBackground = Background; _originalCursor = Cursor; Reset(); }
private void DarkWindow_PreviewMouseMove(object sender, MouseEventArgs e) { const int delta = 10; if (_isResize) { CursorPoint currentScreenCursorPos; GetCursorPos(out currentScreenCursorPos); if (Cursor == Cursors.SizeNWSE) { Width = Math.Max(100, _captureWindowSize.Width + (currentScreenCursorPos.X - _captureScreenCursorPos.X)); Height = Math.Max(100, _captureWindowSize.Height + (currentScreenCursorPos.Y - _captureScreenCursorPos.Y)); } if (Cursor == Cursors.SizeNESW) { Rect rectListBox = VisualTreeHelper.GetDescendantBounds(((MainWindow)Owner).AuthorsListBox); double rectListBoxLeft = ((MainWindow)Owner).AuthorsListBox.PointToScreen(rectListBox.Location).X; Width = Math.Max(100, _captureWindowSize.Width + (_captureScreenCursorPos.X - currentScreenCursorPos.X)); Left = Math.Min(rectListBoxLeft - Width, _captureWindowPosition.X - (_captureScreenCursorPos.X - currentScreenCursorPos.X)); Height = Math.Max(100, _captureWindowSize.Height + (currentScreenCursorPos.Y - _captureScreenCursorPos.Y)); } } else { Point currentCursorPos = e.GetPosition(this); Cursor tempCursor = null; if ((currentCursorPos.X < delta) && (currentCursorPos.Y > ActualHeight - delta) && (_advancedAuthorWindowPosition == AdvancedAuthorWindowPosition.Left)) { tempCursor = Cursors.SizeNESW; } if ((currentCursorPos.X > ActualWidth - delta) && (currentCursorPos.Y > ActualHeight - delta) && (_advancedAuthorWindowPosition == AdvancedAuthorWindowPosition.Right)) { tempCursor = Cursors.SizeNWSE; } if (tempCursor != null) { Cursor = tempCursor; } else { ClearValue(CursorProperty); } } }
void BuildAdornerCorner(ref Thumb cornerThumb, System.Windows.Input.Cursor customCursor) { if (cornerThumb != null) { return; } cornerThumb = new Thumb(); cornerThumb.Cursor = customCursor; cornerThumb.Height = cornerThumb.Width = 10; cornerThumb.Opacity = 1; cornerThumb.Background = new SolidColorBrush(Colors.Black); visualChildren.Add(cornerThumb); }
public void Magnifier_MenuItem_Click(object sender, RoutedEventArgs e) { UnregisterMouseEvents(); m_MagnifierSettings.IsMagniferEnabled = true; Image image = new Image(); image.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/checkmark.gif", UriKind.Relative)); Magnifier_MenuItem.Icon = image; Stream cursorStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("L3.Cargo.Workstation.Plugins.XRayImageBase.Resources.Cursors.magnify.cur"); Cursor CustomCursor = new System.Windows.Input.Cursor(cursorStream); MainXRayView.MainImage.Cursor = CustomCursor; }
/// <summary> /// Translator for Cursor /// </summary> private static void CursorPropertyTranslator(object host, string propertyName, object value) { ElementHost elementHost = host as ElementHost; if (elementHost != null) { AvalonAdapter adapter = elementHost.HostContainerInternal; if (adapter != null) { //Note: Allow nulls to propagate SWF.Cursor fromCursor = value as SWF.Cursor; SWI.Cursor toCursor = Convert.ToSystemWindowsInputCursor(fromCursor); adapter.Cursor = toCursor; } } }
public void Measurements_MenuItem_Click(object sender, RoutedEventArgs e) { UnregisterMouseEvents(); Measurement_Show_MenuItem_Click(sender, e); MeasureAdorner adorner = (MainXRayView.AdornerLayerManager[AdornerLayerManager.MEASUREMENT_ADORNER] as MeasureAdorner); adorner.Enabled = true; Image image = new Image(); image.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/checkmark.gif", UriKind.Relative)); Measurements_MenuItem.Icon = image; Stream cursorStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("L3.Cargo.Workstation.Plugins.XRayImageBase.Resources.Cursors.ruler.cur"); Cursor CustomCursor = new System.Windows.Input.Cursor(cursorStream); MainXRayView.MainImage.Cursor = CustomCursor; }
private void Btn_kiemtra_Click(object sender, EventArgs e) { System.Windows.Input.Cursor oldCursor = Mouse.OverrideCursor; try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; WindowState = FormWindowState.Minimized; FindListNG(); FindListWrong12hours(); FindSpecialRule(); WindowState = FormWindowState.Maximized; } catch (Exception ex) { Logfile.Output(StatusLog.Error, "check error", ex.Message); } finally { Mouse.OverrideCursor = oldCursor; } }
/// <summary> /// 鼠标释放,结束拖动歌词 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CanvasLyric_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { try { System.Windows.Input.Cursor csC = new System.Windows.Input.Cursor(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\cursor\\hand-open.cur"); this.Cursor = csC; } catch { } BaseLine.Visibility = Visibility.Collapsed; tbDragTime.Visibility = Visibility.Collapsed; if (IsStartDragLyric == true) { IsStartDragLyric = false; if (isR == true) { LyricShow.IsPauseLyricShow = false; if (DragAfterLyricTime == DragBeforeLyricTime) { //有按下拖动歌词的意愿,但实际是没有拖动歌词,那么直接刷新不跳播 LyricShow.refrshLyricShowWhenSkipPlay(player.Position.TotalSeconds); } else { //刷新,并跳播 LyricShow.refrshLyricShowWhenSkipPlay(DragAfterLyricTime); player.Position = TimeSpan.FromSeconds(DragAfterLyricTime); player.Play(); } } else { LyricShow.IsPauseLyricShow = true; player.Position = TimeSpan.FromSeconds(DragAfterLyricTime); LyricShow.refrshLyricShowWhenSkipPlay(DragAfterLyricTime); // TBTime.Text = string.Format("0:{0}:{1}", player.Position.Minutes, player.Position.Seconds); } } }
// Top-level method that generates all of the scaffolding output from the templates. // Shows a busy wait mouse cursor while working. public override void GenerateCode() { var project = Context.ActiveProject; var selectionRelativePath = GetSelectionRelativePath(); var modelFolderPath = GetModelFolderPath(selectionRelativePath: selectionRelativePath); if (_codeGeneratorViewModel == null) { throw new InvalidOperationException(message: Resources.WebFormsScaffolder_ShowUIAndValidateNotCalled); } Cursor currentCursor = Mouse.OverrideCursor; try { Mouse.OverrideCursor = Cursors.Wait; GenerateCode(project: project, selectionRelativePath: selectionRelativePath, codeGeneratorViewModel: this._codeGeneratorViewModel); } finally { Mouse.OverrideCursor = currentCursor; } }
private void Button1_Click(object sender, EventArgs e) { System.Windows.Input.Cursor oldCursor = Mouse.OverrideCursor; try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; tmrCallBgWorker.Interval = 30000; GetAttendanceHR getAttendance = new GetAttendanceHR(); attendanceDepts = getAttendance.GetAttendanceDeptsNew(dtpk_choose.Value); DisplayLabelCompany(); ListAttendance = attendanceDepts.GroupBy(u => u.BigDeptCode) .Select(grp => grp.ToList()) .ToList(); ResourceDept1 = new HumanResourceDept(ListAttendance[0]); ResourceDept2 = new HumanResourceDept(ListAttendance[1]); ResourceDept1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); ResourceDept2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); IntializeforTableLayout(ListAttendance, CurrentStart); //pic_loader.Visible = false; tmrCallBgWorker.Start(); hRReport = HRReportStatus.start; btn_HRReport.BackColor = Color.Green; } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "", ex.Message); } finally { Mouse.OverrideCursor = oldCursor; } }
/// <summary> /// Creates a manager for the drawing operations of a document viewer. /// </summary> internal RowHeaderCanvas() { // Indicates that the row can be selected. this.selectRow = new Cursor(Application.GetResourceStream(new Uri("/FluidTrade.FluidTradeWindows;component/Controls/Resources/SelectRow.cur", UriKind.Relative)).Stream); // Indicates that a row is being resized. this.horizontalSplit = new Cursor(Application.GetResourceStream(new Uri("/FluidTrade.FluidTradeWindows;component/Controls/Resources/HorizontalSplit.cur", UriKind.Relative)).Stream); // This cursor indicates that a row will be deleted if dropped. this.bigEx = new Cursor(Application.GetResourceStream(new Uri("/FluidTrade.FluidTradeWindows;component/Controls/Resources/BigEx.cur", UriKind.Relative)).Stream); // The Row Popup is used for drag and drop operations that move the row from one place to another or removes it // from the report. this.headerPopup = new HeaderPopup(); this.headerPopup.PlacementTarget = this; this.headerPopup.Orientation = Orientation.Horizontal; // The Row Height Popup is used when resizing a row. It provides feedback about the proposed new size of the // row. this.rowHeightPopup = new RowHeightPopup(); this.rowHeightPopup.PlacementTarget = this; this.rowHeightPopup.HorizontalOffset = 2.0; // The Destination Popup displays two red arrows to indicate the destination location of a drag-and-drop operation for // a row heading. this.destinationPopup = new DestinationPopup(); this.destinationPopup.PlacementTarget = this; this.destinationPopup.Orientation = Orientation.Horizontal; this.destinationPopup.HorizontalOffset = 0.0; // These lists are used to manage the selection of rows. this.selectedRanges = new List <List <ReportRow> >(); this.headerCells = new List <ReportCell>(); // Command Bindings this.CommandBindings.Add(new CommandBinding(RowHeaderCanvas.FreezeRowHeaders, HandleFrozenHeader)); }
// 07-18-2011 public System.Windows.Input.Cursor CheckCursorForResize(Point pt, Rectangle rect) { System.Windows.Input.Cursor cursor = null; double space = 3; if ((pt.X >= 0 && pt.X <= space) || (pt.X >= rect.ActualWidth - space && pt.X <= rect.ActualWidth) && pt.Y >= 0 && pt.Y <= rect.ActualHeight) { cursor = System.Windows.Input.Cursors.SizeWE; } if ((pt.Y >= 0 && pt.Y <= space) || (pt.Y >= rect.ActualHeight - space && pt.Y <= rect.ActualHeight) && pt.X >= 0 && pt.Y <= rect.ActualHeight) { cursor = System.Windows.Input.Cursors.SizeNS; } if ((pt.X >= 0 && pt.X <= space) && (pt.Y >= 0 && pt.Y <= space) || (pt.X >= rect.ActualWidth - space && pt.X <= rect.ActualWidth) && (pt.Y >= rect.ActualHeight - space && pt.Y <= rect.ActualHeight)) { cursor = System.Windows.Input.Cursors.SizeNWSE; } if ((pt.X >= 0 && pt.X <= space) && (pt.Y >= rect.ActualHeight - space && pt.Y <= rect.ActualHeight) || (pt.Y >= 0 && pt.Y <= space) && (pt.X >= rect.ActualWidth - space && pt.X <= rect.ActualWidth)) { cursor = System.Windows.Input.Cursors.SizeNESW; } if (cursor != null) { Drawing.Canvas.Cursor = cursor; } else { Drawing.Canvas.Cursor = System.Windows.Input.Cursors.Arrow; } return(cursor); }
// Helper method to instantiate the corner Thumbs, set the Cursor property, // set some appearance properties, and add the elements to the visual tree. private void BuildAdornerCorner(ref Thumb cornerThumb, Cursor customizedCursor, Style s = null) { if (cornerThumb != null) { return; } cornerThumb = new Thumb(); if (s != null) { cornerThumb.Style = s; } else { cornerThumb.Style = (Style)vm.FindResource("ResizeThumbStyle"); } // Set some arbitrary visual characteristics. cornerThumb.Cursor = customizedCursor; cornerThumb.Height = cornerThumb.Width = 10; _visualChildren.Add(cornerThumb); }
private void buttonDecompileContinue_Click(object sender, RoutedEventArgs e) { System.Windows.Input.Cursor cursor = Mouse.OverrideCursor; if (null == cursor) { cursor = System.Windows.Input.Cursors.Arrow; } Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; try { sourceFile = textBoxDecompileSource.Text; targetFolder = textBoxDecompileFolder.Text; if (!Directory.Exists(targetFolder) || !File.Exists(sourceFile)) { return; } if (Directory.GetFiles(targetFolder).Length > 0 || Directory.GetDirectories(targetFolder).Length > 0) { System.Windows.MessageBox.Show("This folder already contains files.\n\nChoose another location or empty this folder and try again.", "SB-Prime", MessageBoxButton.OK, MessageBoxImage.Warning); return; } string targetProg = textBoxDecompileFolder.Text + "\\" + Path.GetFileNameWithoutExtension(sourceFile) + ".csproj"; bConsole = (bool)checkBoxConsole.IsChecked; if (mainWindow.sbInterop.Decomple(targetProg, sourceFile, bConsole)) { Close(); } } catch (Exception ex) { MainWindow.Errors.Add(new Error("Decomple : " + ex.Message)); } Mouse.OverrideCursor = cursor; }
public WaitCursor() { _previousCursor = Mouse.OverrideCursor; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; }
private void Btn_absenceList_Click(object sender, EventArgs e) { System.Windows.Input.Cursor oldCursor = Mouse.OverrideCursor; try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; //pic_loader.Visible = true; //pic_loader.Image = global::WindowsFormsApplication1.Properties.Resources.loader; System.Windows.Forms.SaveFileDialog saveFileDialog = new SaveFileDialog(); string pathsave = ""; saveFileDialog.Title = "Browse Excel Files"; saveFileDialog.DefaultExt = "Excel"; saveFileDialog.Filter = "Excel files (*.xlsx)|*.xlsx"; saveFileDialog.CheckPathExists = true; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { GetdataInout getdataInout = new GetdataInout(); List <EmployeeAbsence> employeeAbsences = new List <EmployeeAbsence>(); int IDSession = GetSessionID.GetsessionID(dtpk_choose.Value); List <EmployeeAbsence> employeeAbsencesDay = getdataInout.GetEmployeeAbsencesDayShift(dtpk_choose.Value, IDSession); List <EmployeeAbsence> employeeAbsencesDayNotPaiPan = getdataInout.GetEmployeeAbsencesDayShiftNotPaipan(dtpk_choose.Value, IDSession); List <EmployeeAbsence> employeeAbsencesNightShift = getdataInout.GetEmployeeAbsencesNightShift(dtpk_choose.Value, IDSession); employeeAbsences.AddRange(employeeAbsencesDay); employeeAbsences.AddRange(employeeAbsencesDayNotPaiPan); employeeAbsences.AddRange(employeeAbsencesNightShift); HRReport hRReport = new HRReport(); pathsave = saveFileDialog.FileName; saveFileDialog.RestoreDirectory = true; hRReport.ExportExcelAbsenceReport(pathsave, employeeAbsences, dtpk_choose.Value); var resultMessage = MessageBox.Show("Absence Daily Report export to excel sucessful ! \n\r Do you want to open this file ?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (resultMessage == DialogResult.Yes) { FileInfo fi = new FileInfo(pathsave); if (fi.Exists) { System.Diagnostics.Process.Start(pathsave); } else { MessageBox.Show("File doestn't exist !", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } // WindowAbsenceList windowAbsenceList = new WindowAbsenceList(employeeAbsences); //windowAbsenceList.Show(); } catch (Exception) { throw; } finally { Mouse.OverrideCursor = oldCursor; } }