private void OnMouseLeave(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (sender is Control component)
     {
         component.Cursor = null;
     }
 }
 private void OnMouseEnter(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (sender is Control component)
     {
         component.Cursor = Cursors.Hand;
     }
 }
Exemplo n.º 3
0
 void _gridPatternsToOpen_MouseClick(object sender, System.Windows.Forms.MouseEventArgs mouse)
 {
     if (mouse.Button == MouseButtons.Left &&
         _gridPatternsToOpen.SelectedCells.Count != 0)
     {
         PaintOpenPattern(_gridPatternsToOpen.SelectedCells[0].RowIndex);
         return;
     }
 }
Exemplo n.º 4
0
 void _gridPatternsToClose_MouseClick(object sender, System.Windows.Forms.MouseEventArgs mouse)
 {
     if (mouse.Button == MouseButtons.Left)
     {
         if (_gridPatternsToClose.SelectedCells.Count == 0)
         {
             return;
         }
         PaintClosePattern(_gridPatternsToClose.SelectedCells[0].RowIndex);
     }
 }
Exemplo n.º 5
0
 private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (isMouseDown)
     {
         int deltaX = e.X - cx;
         int deltaY = e.Y - cy;
         mx += deltaX;
         my += deltaY;
         cx  = e.X;
         cy  = e.Y;
         form.Refresh();
     }
 }
Exemplo n.º 6
0
 // 托盘图标鼠标单击事件
 private void NotifyIcon_MouseClick(object sender, SWF.MouseEventArgs e)
 {
     if (e.Button == SWF.MouseButtons.Left)
     {
         if (this.Visibility == Visibility.Visible)
         {
             this.Visibility = Visibility.Hidden;
         }
         else
         {
             this.Visibility = Visibility.Visible;
             this.Activate();
         }
     }
 }
        /// <summary>
        /// Called when the user clicks on the screen
        /// </summary>
        /// <param name="sender">Sening object</param>
        /// <param name="e">Event arguments</param>
        private void OnMouseClickOnScreen(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            var formLocation = new System.Drawing.Point((int)screenResolution.ConvertXDpi(e.Location.X), (int)screenResolution.ConvertYDpi(e.Location.Y));

            // Only interessting for Touch Friendly)
            if (PinStyle != PinStyle.TouchFriendly && PinStyle != PinStyle.AlwaysOff && PinStyle != PinStyle.Manual)
            {
                return;
            }

            // if the screen is not hidden, than everything is ok
            if (Hidden || IsAnimating)
            {
                return;
            }

            // Check if the user clicks outside the current window
            bool mustHide = !(new Rectangle((int)Left, (int)Top, (int)Width, (int)Height).Contains(formLocation));

            if (!mustHide)
            {
                return;
            }

            // Check if the user pressed the magic key
            Storyboard sliding;

            latencyTimer.Stop();
            if (IsMagicKeyPressed && PinStyle == PinStyle.AlwaysOn)
            {
                return;
            }

            // Stop the current animation and hide the window
            if ((sliding = slideIn) != null)
            {
                sliding.Stop();
            }

            BeginAnimation(slideOut);
        }
        /// <summary>
        /// Called when the user moves the mouse onto the screen
        /// </summary>
        /// <param name="sender">Sening object</param>
        /// <param name="e">Event arguments</param>
        private void OnMouseMoveOnScreen(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Only interessting for Sliding Style AlwaysOn
            if (PinStyle != PinStyle.AlwaysOn)
            {
                return;
            }

            // if the screen is not hidden, than everything is ok
            if (!Hidden || IsAnimating)
            {
                return;
            }

            bool mustShow = !(new Rectangle((int)Left, (int)Top, (int)Width, (int)Height).Contains(e.Location));

            if (mustShow)
            {
                BeginAnimation(reduceOpacity);
            }
        }
Exemplo n.º 9
0
 private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     isMouseDown = false;
 }
Exemplo n.º 10
0
 private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     isMouseDown = true;
     cx          = e.X;
     cy          = e.Y;
 }
Exemplo n.º 11
0
 private void Form1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     mashtabK += e.Delta;
     form.Refresh();
 }