Ejemplo n.º 1
0
        /// <summary>
        /// 重载WbdProc,实现热键响应
        /// </summary>
        /// <param name="m"></param>
        protected override void WndProc(ref Message m)
        {
            const int WM_HOTKEY = 0x0312;

            //按快捷键
            if (m.Msg == WM_HOTKEY)
            {
                switch (m.WParam.ToInt32())
                {
                    case 100:
                        {
                            groupTree.Select();
                            statusLabel.Text = "按下F1键:焦点移到到选择组区。";
                        }
                        break;
                    case 1:    //按下的是F1,则相应
                        {
                            HotKey.UnregisterHotKey(Handle, 100);//注销热键
                            HotKey.UnregisterHotKey(Handle, 101);
                            HotKey.UnregisterHotKey(Handle, 102);
                        }
                        break;
                }
            }
            base.WndProc(ref m);
        }
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            // focus package combo box
            if (keyData == (Keys.Alt | Keys.P))
            {
                packageComboBox.Focus();
                return true;

            } // focus fragrance combo box
            else if (keyData == (Keys.Alt | Keys.F))
            {
                fragranceComboBox.Focus();
                return true;

            } // focus exterior list box
            else if (keyData == (Keys.Alt | Keys.E))
            {
                exteriorListBox.Focus();
                return true;

            } // focus interior listbox
            else if (keyData == (Keys.Alt | Keys.I))
            {
                interiorListBox.Focus();
                return true;
            }

            // return flase as the key combo wasn't found
            return false;
        }
Ejemplo n.º 3
0
        protected override void WndProc(ref Message m)
        {
            if (MessageReceived != null)
                MessageReceived(ref m);

            base.WndProc(ref m);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The filter message.
        /// </summary>
        public bool PreFilterMessage(ref Message m)
        {
            bool handled = false;
            Keys key = Keys.None;

            switch (m.Msg)
            {
                case WM_KEYUP:
                    key = (Keys)m.WParam;
                    handled = HandleModifier(key, false);
                    break;

                case WM_KEYDOWN:
                    key = (Keys)m.WParam;
                    handled = HandleModifier(key, true);
                    if (false == handled)
                    {
                        // If one of the defined keys was pressed then we
                        // raise an event.
                        handled = HandleDefinedKey(key);
                    }
                    break;
            }

            return handled;
        }
Ejemplo n.º 5
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case 0x1000 + 145:
                    // LVM_INSERTGROUP = LVM_FIRST + 145;
                    // Add the collapsible feature id needed
                    LVGROUP lvgroup = (LVGROUP)Marshal.PtrToStructure(m.LParam, typeof(LVGROUP));
                    lvgroup.state = (int)GroupState.COLLAPSIBLE;
                    // LVGS_COLLAPSIBLE
                    lvgroup.mask = lvgroup.mask ^ 4;
                    // LVGF_STATE
                    Marshal.StructureToPtr(lvgroup, m.LParam, true);
                    base.WndProc(ref m);
                    break;
                case 0x202:
                    //WM_LBUTTONUP
                    base.DefWndProc(ref m);
                    base.WndProc(ref m);
                    break;
                /*case 0x83: // WM_NCCALCSIZE
                    int style = (int)GetWindowLong(this.Handle, GwlStyle);
                    if ((style & WsHscroll) == WsHscroll)
                        SetWindowLong(this.Handle, GwlStyle, style & ~WsHscroll);
                    base.WndProc(ref m);
                    break;*/

                default:
                    base.WndProc(ref m);
                    break;
            }
        }
Ejemplo n.º 6
0
        protected override void WndProc(ref Message m)
        {
            // Swallow mouse messages that are not in the client area
                        if (m.Msg >= 0x201 && m.Msg <= 0x209)
                        {
                            Point pos = new Point((int) (m.LParam.ToInt64() & 0xffff), (int) (m.LParam.ToInt64() >> 16));
                            var hit = this.HitTest(pos);
                            switch (hit.Location)
                            {
                                case ListViewHitTestLocations.AboveClientArea:
                                case ListViewHitTestLocations.BelowClientArea:
                                case ListViewHitTestLocations.LeftOfClientArea:
                                case ListViewHitTestLocations.RightOfClientArea:
                                case ListViewHitTestLocations.None:
                                    return;
                            }
                        }

            //hide scroll
            switch (m.Msg)
            {
                case 0x83: // WM_NCCALCSIZE
                    int style = (int)GetWindowLong(this.Handle, GWL_STYLE);
                    if ((style & WS_HSCROLL) == WS_HSCROLL)
                        SetWindowLong(this.Handle, GWL_STYLE, style & ~WS_HSCROLL);
                    base.WndProc(ref m);
                    break;
                default:
                    base.WndProc(ref m);
                    break;
            }


        }
Ejemplo n.º 7
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WindowNative.WM_COPYDATA:

                    // Get the COPYDATASTRUCT struct from LParam
                    COPYDATASTRUCT cds = (COPYDATASTRUCT)m.GetLParam(
                        typeof(COPYDATASTRUCT));

                    if (cds.cbData == Marshal.SizeOf(typeof(MyStruct)))
                    {
                        // Marshal the data from the unmanaged memory block
                        object data = Marshal.PtrToStructure(cds.lpData,
                            typeof(MyStruct));

                        // Cast the data to MyStruct
                        MyStruct myStruct = (MyStruct)data;

                        // Display the MyStruct data
                        this.lbNumber.Text = myStruct.nNumber.ToString();
                        this.lbMessage.Text = myStruct.strMessage;
                    }
                    break;
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 8
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     try {
         switch (keyData) {
             case Keys.Escape:
                 DialogResult = DialogResult.OK;
                 break;
             case Keys.E:
                 MessageBox.Show(EnvironmentInfo.EnvironmentToString(true));
                 break;
             case Keys.L:
                 try {
                     if (File.Exists( MainForm.LogFileLocation)) {
                         System.Diagnostics.Process.Start("\"" + MainForm.LogFileLocation + "\"");
                     } else {
                         MessageBox.Show("Greenshot can't write to logfile, otherwise it would be here: " + MainForm.LogFileLocation);
                     }
                 } catch (Exception) {
                     MessageBox.Show("Couldn't open the greenshot.log, it's located here: " + MainForm.LogFileLocation, "Error opening greeenshot.log", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 }
                 break;
             case Keys.I:
                 try {
                     System.Diagnostics.Process.Start("\"" + IniFile.IniConfig.ConfigLocation + "\"");
                 } catch (Exception) {
                     MessageBox.Show("Couldn't open the greenshot.ini, it's located here: " + IniFile.IniConfig.ConfigLocation, "Error opening greeenshot.ini", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 }
                 break;
             default:
                 return base.ProcessCmdKey(ref msg, keyData);
         }
     } catch (Exception) {
     }
     return true;
 }
        public static void ProcessKeyPreview(ref Message m, Keys ModifierKeys)
        {
            const int WM_KEYDOWN = 0x100;
            //const int WM_KEYUP = 0x101;
            const int WM_CHAR = 0x102;
            const int WM_SYSCHAR = 0x106;
            const int WM_SYSKEYDOWN = 0x104;
            //const int WM_SYSKEYUP = 0x105;
            const int WM_IME_CHAR = 0x286;

            KeyEventArgs e = null;

            if ((m.Msg != WM_CHAR) && (m.Msg != WM_SYSCHAR) && (m.Msg != WM_IME_CHAR))
            {
                e = new KeyEventArgs(((Keys)((int)((long)m.WParam))) | ModifierKeys);
                if ((m.Msg == WM_KEYDOWN) || (m.Msg == WM_SYSKEYDOWN))
                    control.TrappedKeyDown(e);

                // Remove any WM_CHAR type messages if supresskeypress is true.
                if (e.SuppressKeyPress)
                {
                    RemovePendingMessages(WM_CHAR, WM_CHAR);
                    RemovePendingMessages(WM_SYSCHAR, WM_SYSCHAR);
                    RemovePendingMessages(WM_IME_CHAR, WM_IME_CHAR);
                }
            }
        }
Ejemplo n.º 10
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
                case Keys.F5:
                    _refresh.PerformClick();
                    return true;

                case Keys.Home:
                    _home.PerformClick();
                    return true;

                case Keys.Control | Keys.F:
                    _search.Focus();
                    _search.SelectAll();
                    break;

                case Keys.Escape:
                    if (_isNavigating)
                        _stop.PerformClick();
                    else
                        Close();

                    return true;

                case Keys.Control | Keys.P:
                    _print.PerformClick();
                    break;
            }

            return base.ProcessCmdKey(ref msg, keyData);
        }
Ejemplo n.º 11
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if ((keyData & Keys.F5) == Keys.F5)
                this.TriggerCompileButtonClicked();

            return base.ProcessCmdKey(ref msg, keyData);
        }
Ejemplo n.º 12
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData.HasFlag(Keys.Control))
            {
                if (keyData.HasFlag(Keys.O))
                {
                    OpenMenuItem.PerformClick();
                    return true;
                }
                if (keyData.HasFlag(Keys.Alt) && keyData.HasFlag(Keys.Shift) && keyData.HasFlag(Keys.S))
                {
                    SaveDecryptedMenuItem.PerformClick();
                    return true;
                }
                if (keyData.HasFlag(Keys.Shift) && keyData.HasFlag(Keys.S))
                {
                    SaveEncryptedMenuItem.PerformClick();
                    return true;
                }
                if (keyData.HasFlag(Keys.S))
                {
                    SaveMenuItem.PerformClick();
                    return true;
                }
            }

            return m_tabPages.Any(tabPage => tabPage.OnHotkey(keyData)) || base.ProcessCmdKey(ref msg, keyData);
        }
Ejemplo n.º 13
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if ((keyData == Keys.PageDown))
     {
         dataGridView1.ClearSelection();
         dataGridView4.ClearSelection();
         dataGridView4.Focus();
         dataGridView4.Rows[0].Selected = true;
         showDetail(dataGridView4.Rows[0].Cells[1].Value.ToString());
         return true;
     }
     else if (keyData == Keys.PageUp)
     {
         dataGridView1.ClearSelection();
         dataGridView4.ClearSelection();
         dataGridView1.Focus();
         dataGridView1.Rows[0].Selected = true;
         showDetail(dataGridView1.Rows[0].Cells[1].Value.ToString());
         return true;
     }
     else
     {
         return base.ProcessCmdKey(ref msg, keyData);
     }
 }
Ejemplo n.º 14
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_SIZING && m.HWnd.Equals(this.Handle))
            {
                Rect r = new Rect();
                r = (Rect)Marshal.PtrToStructure(m.LParam, r.GetType());

                double width = r.Right - r.Left;
                double height = r.Bottom - r.Top;

                if (height / width > aspect_ratio((int)width))
                    width = height / aspect_ratio((int)width);
                else
                    height = width * aspect_ratio((int)width);

                if (m.WParam.ToInt32() == WMSZ_TOP || m.WParam.ToInt32() == WMSZ_TOPLEFT || m.WParam.ToInt32() == WMSZ_TOPRIGHT)
                    r.Top = r.Bottom - (int)height;
                else
                    r.Bottom = r.Top + (int)height;

                if (m.WParam.ToInt32() == WMSZ_LEFT || m.WParam.ToInt32() == WMSZ_TOPLEFT || m.WParam.ToInt32() == WMSZ_BOTTOMLEFT)
                    r.Left = r.Right - (int)width;
                else
                    r.Right = r.Left + (int)width;

                Marshal.StructureToPtr(r, m.LParam, true);
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Filters messages before they are actually send to the application.
        /// </summary>
        /// <param name="m">The message send to the application.</param>
        /// <returns>Return false to allow the application to handle the message. Return true to hide the message from the application.</returns>
        public bool PreFilterMessage(ref Message m)
        {
            switch ((MouseFilterEvents)m.Msg)
            {
                case MouseFilterEvents.LButtonDown:
                    OnMouseDown(new MouseEventArgs(
                        MouseButtons.Left,                      // Button
                        1,                                      // Number of Clicks
                        Cursor.Position.X, Cursor.Position.Y,   // Position
                        0                                       // Scroll Ticks
                    ));
                    break;

                case MouseFilterEvents.LButtonUp:
                    OnMouseUp(new MouseEventArgs(
                        MouseButtons.Left,                      // Button
                        1,                                      // Number of Clicks
                        Cursor.Position.X, Cursor.Position.Y,   // Position
                        0                                       // Scroll Ticks
                    ));
                    break;
            }

            return false;
        }
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 0x0203) // WM_LBUTTONDBLCLK
     {
         // Do nothing:
         // This prevents embedded RichText objects from being edited by double-clicking them from a
         // RichText control.  See:  http://stackoverflow.com/questions/1149811/net-framework-how-to-make-richtextbox-true-read-only
     }
     else if (m.Msg == 0x000F) // WM_PAINT
     {
         if (!Drawing)
         {
             base.WndProc(ref m); // if we decided to paint this control, just call the RichTextBox WndProc
         }
         else
         {
             m.Result = IntPtr.Zero; // not painting, must set this to IntPtr.Zero if not painting otherwise serious problems.
         }
     }
     else
     {
         try
         {
             base.WndProc(ref m);
         }
         catch { }
     }
 }
Ejemplo n.º 17
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case User32.WM_PAINT:
                {
                    try
                    {
                        m_painting = true;
                        base.WndProc(ref m);

                        if (VirtualListSize == 0)
                        {
                            using (Graphics gfx = CreateGraphics())
                                DrawBackground(gfx, Bounds, BackColor);
                        }
                    }
                    finally
                    {
                        m_painting = false;
                    }
                }
                break;

                default:
                    base.WndProc(ref m);
                    break;
            }
        }
        protected override void WndProc(ref Message message)
        {
            switch (message.Msg)
            {
                case Win32.WM_INPUT:
                    {
                        _keyboardDriver.ProcessRawInput(message.LParam);
                    }
                    break;

                case Win32.WM_USB_DEVICECHANGE:
                    {
                        if (delemiter == 1)
                        {
                            Debug.WriteLine("USB Device Arrival / Removal");
                            _keyboardDriver.EnumerateDevices();
                            delemiter = 0;
                        }
                        else
                            delemiter = 1;
                    }
                    break;
            }

            base.WndProc(ref message);
        }
Ejemplo n.º 19
0
        protected void MessageEvent(object sender, ref Message m, ref bool handled) {
            //Handle WM_Hotkey event
            if (handled) {
                return;
            }

            switch ((Win32Msgs)m.Msg) {
                case Win32Msgs.WM_DRAWCLIPBOARD:
                    handled = true;

                    if (Changed != null) {
                        Changed(this, EventArgs.Empty);
                    }

                    User32.SendMessage(nextWindow, m.Msg, m.WParam, m.LParam);

                    break;

                case Win32Msgs.WM_CHANGECBCHAIN:
                    if (m.WParam == nextWindow) {
                        nextWindow = m.LParam;
                    } else {
                        User32.SendMessage(nextWindow, m.Msg, m.WParam, m.LParam);
                    }
                    break;
            }
        }
Ejemplo n.º 20
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            if (m.Msg == HotKeys.WM_HOTKEY)
                HotKeys.TriggerKey(this.id);
        }
Ejemplo n.º 21
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == Program.WM_ACTIVATEAPP && m.WParam.ToInt32() == Program.ProgramId)
                ShowWindow();
            else if (m.Msg == WinAPI.WM_COPYDATA)
            {
                ShowWindow();
                logger.Log(LogLevel.Trace, "Received message WM_COPYDATA");
                try
                {

                    WinAPI.CopyDataStruct data = (WinAPI.CopyDataStruct)m.GetLParam(typeof(WinAPI.CopyDataStruct));
                    string message = string.Empty;
                    unsafe
                    {
                        message = new string((char*)(data.lpData), 0, data.cbData / 2);
                    }
                    logger.Log(LogLevel.Trace, "\tdata: " + message);

                    m.Result = new IntPtr(1); //return "True" to caller

                    ShowNotification("Received message: " + message);
                    if (!model.LoadTorrent(message))
                        ShowNotification("Error loading torrent " + message);
                }
                catch (Exception ex)
                {
                    logger.Log(LogLevel.Error, "Error retrieving message data");
                }
            }
            else
                base.WndProc(ref m);
        }
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            int x = 0;
            int y = 0;

            if(m.Msg == 0xca)
            {
                x = Cursor.Position.X;
                y = Cursor.Position.Y;

                if(
                    (x < this.Location.X) ||
                    (this.Location.X + this.Width < x) ||
                    (y < this.Location.Y) ||
                    (this.Location.Y + this.Height < y)
                    )
                {
                    this.Close();
                    return;
                }

                this.Capture = true;
            }
        }
Ejemplo n.º 23
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     char cCaracter = (char)keyData;
     if (char.IsLetterOrDigit(cCaracter) || keyData == Keys.Space)
     {
         this.lblBusqueda.Text += cCaracter;
     }
     else
     {
         switch (keyData)
         {
             case Keys.Escape:
                 if (this.lblBusqueda.Text == "")
                     this.Close();
                 else
                     this.lblBusqueda.Text = "";
                 break;
             case Keys.Back:
                 if (this.lblBusqueda.Text != "")
                     this.lblBusqueda.Text = this.lblBusqueda.Text.Izquierda(this.lblBusqueda.Text.Length - 1);
                 break;
             case Keys.Enter:
                 this.dgvListado_CellDoubleClick(this, null);
                 break;
             case Keys.Up:
                 break;
             case Keys.Down:
                 break;
             // default:
                 // return base.ProcessCmdKey(ref msg, keyData);
         }
     }
     return false;
 }
Ejemplo n.º 24
0
 public void FromMessage(ref Message msg)
 {
     this.Hwnd = msg.HWnd;
     this.Msg = msg.Msg;
     this.WParam = msg.WParam;
     this.LParam = msg.LParam;
 }
Ejemplo n.º 25
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     // http://support.microsoft.com/kb/320584
     const int WM_KEYDOWN = 0x100;
     if (msg.Msg == WM_KEYDOWN)
     {
         if (keyData.Equals(Keys.Control | Keys.A))
         {
             base.SelectAll();
             return true;
         }
         if (keyData.Equals(Keys.Control | Keys.Back))
         {
             if (SelectionStart - 1 < 0)
                 return true;
             int min = Math.Min(SelectionStart, Text.Length - 1);
             int lastSpace = Text.LastIndexOf(' ', min, min);
             if (lastSpace == -1) // we delete all except symbols after selection
             {
                 Text = Text.Substring(SelectionStart);
                 return true;
             }
             string start =  Text.Substring(0, lastSpace);
             string end = Text.Substring(Math.Min(SelectionStart, Text.Length));
             Text = start + end;
             base.Select(lastSpace, 0);
             return true;
         }
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Should the mouse down be eaten when the tracking has been ended.
 /// </summary>
 /// <param name="m">Original message.</param>
 /// <param name="pt">Screen coordinates point.</param>
 /// <returns>True to eat message; otherwise false.</returns>
 public override bool DoesMouseDownGetEaten(Message m, Point pt)
 {
     // If the user dismissed the context menu by clicking down on the drop down button of
     // the KryptonDateTimePicker then eat the down message to prevent the down press from
     // opening the menu again.
     return _dropScreenRect.Contains(new Point(pt.X, pt.Y));
 }
Ejemplo n.º 27
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == Keys.Enter)
     {
         if (!(this.current_focused_control is Button))
         {
             if (this.current_focused_control.Name == this.mskNewSernum.Name)
             {
                 if (ValidateSN.Check(this.mskNewSernum.Text))
                 {
                     SendKeys.Send("{TAB}");
                     return true;
                 }
             }
             else
             {
                 SendKeys.Send("{TAB}");
                 return true;
             }
         }
     }
     if (keyData == Keys.Escape)
     {
         this.DialogResult = DialogResult.Cancel;
         this.Close();
         return true;
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
Ejemplo n.º 28
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WM_CLIPBOARDUPDATE:
                    var args = new ClipbardUpdatedEventArgs();
                    OnClipboardUpdated(args);
                    if (args.Handled) m.Result = IntPtr.Zero;
                    return;
                case WM_DESTROY:
#if DEBUG
                    Console.WriteLine("ClipboardMonitor: WM_DESTROY");
#endif
                    StopMonitor();
                    break;
                case WM_CLOSE:
#if DEBUG
                    Console.WriteLine("ClipboardMonitor: WM_CLOSE");
#endif
                    StopMonitor();
                    break;
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 29
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == _globalMsgV41)
            {
                if (m.WParam == (IntPtr)Snarl.V41.SnarlConnector.GlobalEvent.SnarlQuit)
                {
                    AppController.Stop();
                }
                else if (m.WParam == (IntPtr)Snarl.V41.SnarlConnector.GlobalEvent.SnarlLaunched)
                {
                    AppController.Current.RegisterWithSnarl();
                }
            }
            else if (m.Msg == ReplyMsgV41)
            {
                if (m.WParam == (IntPtr)Snarl.V41.SnarlConnector.MessageEvent.NotificationAck)
                {
                     AppController.Current.MousebuttonHasBeenClicked("left", (Int32)m.LParam);
                }
                else if (m.WParam == (IntPtr)Snarl.V41.SnarlConnector.MessageEvent.NotificationCancelled)
                {
                    AppController.Current.MousebuttonHasBeenClicked("right", (Int32)m.LParam);
                }
                else if (m.WParam == (IntPtr)Snarl.V41.SnarlConnector.MessageEvent.NotificationMiddleButton)
                {
                    AppController.Current.MousebuttonHasBeenClicked("middle", (Int32)m.LParam);
                }
                else if (m.WParam == (IntPtr)Snarl.V41.SnarlConnector.MessageEvent.NotificationTimedOut)
                {

                }
            }
            base.WndProc(ref m);
        }
Ejemplo n.º 30
0
		protected override void WndProc(ref Message m)
		{
			// Check if it's a notification message from the Quart component.
			if (m.Msg == WM_GRAPHNOTIFY)
			{
				int lEventCode;
				int lParam1, lParam2;

				try
				{
					// Retrieve the message.
					mEventEx.GetEvent(out lEventCode, out lParam1,
					  out lParam2, 0);
					mEventEx.FreeEventParams(lEventCode, lParam1, lParam2);

					// Check if it's the end-of-file message.
					if (lEventCode == EC_COMPLETE)
					{
						// Restart the playback.
						mc.Stop();
						position.CurrentPosition = 0;
						mc.Run();
					}
				}
				catch (Exception)
				{
					// Never throw an exception from WndProc().
					// You may want to log it, however.
				}
			}
			// Pass the message along to .NET.
			base.WndProc(ref m);
		}
Ejemplo n.º 31
0
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case 0x004A:
                LOLReplay.Program.COPYDATASTRUCT mystr = new LOLReplay.Program.COPYDATASTRUCT();
                Type mytype = mystr.GetType();
                mystr = (LOLReplay.Program.COPYDATASTRUCT)m.GetLParam(mytype);
                cmd   = mystr.lpData;
                ProcessFile();
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
Ejemplo n.º 32
0
 protected override void WndProc(ref System.Windows.Forms.Message m)
 {
     if (m.Msg == (int)WindowsMessage.WM_LBUTTONDOWN)
     {
         Point    point = this.Control.PointToClient(Cursor.Position);
         vTabPage page  = this.Control.GetTabPageByPoint(point);
         if (page != null)
         {
             this.Control.SelectedPage = page;
             ArrayList selection = new ArrayList();
             selection.Add(page);
             ISelectionService selectionService = (ISelectionService)this.GetService(typeof(ISelectionService));
             selectionService.SetSelectedComponents(selection);
         }
     }
     base.WndProc(ref m);
 }
Ejemplo n.º 33
0
 public override void ProcessWindowMessage(ref System.Windows.Forms.Message m)
 {
     if (m.Msg == _MsgID_KeyboardLL)
     {
         if (KeyboardLLEvent != null)
         {
             KeyboardLLEvent(m.WParam, m.LParam);
         }
     }
     else if (m.Msg == _MsgID_KeyboardLL_HookReplaced)
     {
         if (HookReplaced != null)
         {
             HookReplaced();
         }
     }
 }
Ejemplo n.º 34
0
        //.net 提供了ProcessCmdKey 重新实现Form的键盘消息,这个针对F10进行特殊处理,避免卡屏
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            int WM_KEYDOWN    = 256;
            int WM_SYSKEYDOWN = 260;

            if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
            {
                //F10键自定义处理,不经过系统
                if (keyData == Keys.F10)
                {
                    MirScene.ActiveScene.OnKeyDown(new KeyEventArgs(keyData));
                    return(true);
                }
                //屏蔽win键
            }
            return(false);
        }
Ejemplo n.º 35
0
 protected override void WndProc(ref System.Windows.Forms.Message m)
 {
     if ((this.m_WigglyLines == null) || (this.m_WigglyLines.Count == 0))
     {
         base.WndProc(ref m);
     }
     else if (m.Msg == 15)
     {
         this.parentTextBox.Invalidate();
         base.WndProc(ref m);
         this.CustomPaint();
     }
     else
     {
         base.WndProc(ref m);
     }
 }
Ejemplo n.º 36
0
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case NativeMethods.WM_CREATE:
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    if (Environment.OSVersion.Version.Major >= 6)
                    {
                        NativeMethods.SetWindowTheme(this.Handle, "Explorer", null);
                    }
                }
                break;
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 37
0
 public override void ProcessWindowMessage(ref System.Windows.Forms.Message m)
 {
     if (m.Msg == _MsgID_Mouse)
     {
         if (MouseEvent != null)
         {
             MouseEvent(m.WParam, m.LParam);
         }
     }
     else if (m.Msg == _MsgID_Mouse_HookReplaced)
     {
         if (HookReplaced != null)
         {
             HookReplaced();
         }
     }
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Filters out a message before it is dispatched.
        /// </summary>
        /// <returns>
        /// true to filter the message and stop it from being dispatched; false to allow the message to continue to the next filter or control.
        /// </returns>
        /// <param name="msg">The message to be dispatched. You cannot modify this message.
        /// </param><filterpriority>1</filterpriority>
        bool SWF.IMessageFilter.PreFilterMessage(ref SWF.Message msg)
        {
            const int WM_KEYDOWN = 0x100;

            SWF.Keys keyCode = (SWF.Keys)(int) msg.WParam & SWF.Keys.KeyCode;
            if (msg.Msg == WM_KEYDOWN && keyCode == SWF.Keys.Return)
            {
                cmdOk_Click(this, null);
                return(true);
            }
            if (msg.Msg == WM_KEYDOWN && keyCode == SWF.Keys.Escape)
            {
                cmdCancel_Click(this, null);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Our WndProc which raise to user OnShow and OnHide events
        /// </summary>
        /// <param name="m"></param>
        protected virtual void WndProc(ref System.Windows.Forms.Message m)
        {
            if (m.Msg == (int)Msg.WM_NOTIFY)
            {
                NMHDR note = (NMHDR)m.GetLParam(typeof(NMHDR));

                if (note.code == (int)ToolTipNotifyMsg.TTN_SHOW)
                {
                    m.Result = IntPtr.Zero;
                    RaiseOnShowEvent();
                }
                else if (note.code == (int)ToolTipNotifyMsg.TTN_POP)
                {
                    RaiseOnHideEvent();
                }
            }
        }
Ejemplo n.º 40
0
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            int WM_KEYDOWN = 256;

            int WM_SYSKEYDOWN = 260;

            if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
            {
                switch (keyData)
                {
                case Keys.Escape:
                    关闭ToolStripMenuItem_Click(null, null);
                    break;
                }
            }
            return(false);
        }
Ejemplo n.º 41
0
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case NativeMethods.WM_VSCROLL:
                WmVScroll(ref m);
                break;

            case NativeMethods.WM_HSCROLL:
                WmHScroll(ref m);
                break;

            default:
                base.WndProc(ref m);
                break;
            }
        }
Ejemplo n.º 42
0
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            if (m.Msg == 0x0112) // WM_SYSCOMMAND
            {
                switch ((Int32)m.WParam)
                {
                case 0xF030:     // Maximize event - SC_MAXIMIZE from Winuser.h
                    restored_size = this.Size;
                    break;

                case 0xF120:     // Restore event - SC_RESTORE from Winuser.h
                    this.Size = restored_size;
                    break;
                }
            }
            base.WndProc(ref m);
        }
Ejemplo n.º 43
0
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            if ((!this.dataGridView1.Focused))
            {
                return(base.ProcessCmdKey(ref msg, keyData));
            }
            if (keyData != Keys.Enter)
            {
                return(base.ProcessCmdKey(ref msg, keyData));
            }
            DataGridViewRow  row = this.dataGridView1.CurrentRow;
            frmprovedoresdet frm = new frmprovedoresdet(row.Cells["idproy"].Value.ToString());

            frm.MdiParent = this.MdiParent;
            frm.ShowDialog();
            return(true);
        }
Ejemplo n.º 44
0
            // This method overrides the procedure that responds to Windows messages.

            // It intercepts the WM_MOUSEMOVE message
            // and ignores it if SuppressHighlighting is on and the TopLevelControl does not contain the focus.
            // Otherwise, it calls the base class procedure to handle the message.

            // It also intercepts the WM_MOUSEACTIVATE message and replaces an "Activate and Eat" result with
            // an "Activate" result if ClickThrough is enabled.

            protected override void WndProc(ref System.Windows.Forms.Message m)
            {
                //Try
                //If m.Msg = WinConst.WM_MOUSEMOVE And Not m_ClickThrough And Not Me.TopLevelControl.ContainsFocus Then
                //    Exit Sub
                //Else
                base.WndProc(ref m);
                //End If

                if (m.Msg == WinConst.WM_MOUSEACTIVATE && m_ClickThrough && m.Result == ((IntPtr)WinConst.MA_ACTIVATEANDEAT))
                {
                    m.Result = (IntPtr)WinConst.MA_ACTIVATE;
                }
                //Catch ex As Exception

                //End Try
            }
Ejemplo n.º 45
0
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            //case CodeBarInput.WM_IDCARD_INFO:
            //    {
            //        byte[] cInput = new byte[101];
            //        System.Runtime.InteropServices.Marshal.Copy(m.WParam, cInput, 0, 100);
            //        String sInput = System.Text.Encoding.Default.GetString(cInput);
            //        if (sInput.Length > 0)
            //        {
            //        }
            //    }
            //    break;
            //case CodeBarInput.WM_RFID_INFO:
            //    {
            //        byte[] cInput = new byte[101];
            //        System.Runtime.InteropServices.Marshal.Copy(m.WParam, cInput, 0, 100);
            //        String sInput = System.Text.Encoding.Default.GetString(cInput);
            //        if (sInput.Length > 0)
            //        {
            //        }
            //    }
            //    break;
            //case CodeBarInput.WM_SCANNER_INPUT:
            //    {
            //        byte[] cInput = new byte[101];
            //        System.Runtime.InteropServices.Marshal.Copy(m.WParam, cInput, 0, 100);
            //        String sInput = System.Text.Encoding.Default.GetString(cInput);
            //        string barcode = Convert.ToString(sInput).Trim('\0');

            //        if (this.barMainContainer.SelectedDockContainerItem.Tag is EfwControls.CustomControl.BaseFormEx)
            //        {
            //            (this.barMainContainer.SelectedDockContainerItem.Tag as EfwControls.CustomControl.BaseFormEx).doBarCode(barcode);
            //        }
            //    }
            //    break;
            case WindowsAPI.WM_ASYN_INPUT:
                InvokeController("AsynInitCompleted");
                break;

            default:
                base.DefWndProc(ref m);    //调用基类函数处理非自定义消息。
                break;
            }
        }
Ejemplo n.º 46
0
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case WM_NCHITTEST:
                base.WndProc(ref m);
                if (m.Result == (IntPtr)HTCLIENT)
                {
                    m.Result = (IntPtr)HTCAPTION;
                }
                break;

            default:
                base.WndProc(ref m);
                break;
            }
        }
Ejemplo n.º 47
0
 //Prepocesar mensajes
 public override bool PreProcessMessage(ref System.Windows.Forms.Message msg)
 {
     if (msg.Msg == 257 && (int)msg.WParam == 13) //Si es //KeyDown// y //Enter//
     {
         int MiCol = 0;
         int MiFil = this.CurrentCell.RowIndex - 1;
         if (this.CurrentCell.ColumnIndex < this.ColumnCount - 1) //Si noSalimos del limite
         {
             MiCol = this.CurrentCell.ColumnIndex + 1;            //Siguiente columna
         }
         if (MiFil > -1)
         {
             this.CurrentCell = this[MiCol, MiFil];             //Posicionar columna
         }
     }
     return(base.PreProcessMessage(ref msg));
 }
Ejemplo n.º 48
0
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, Keys keyData)

        {
            int WM_KEYDOWN    = 256;
            int WM_SYSKEYDOWN = 260;

            if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
            {
                switch (keyData)
                {
                case Keys.Escape:
                    this.Close();    //esc关闭窗体
                    break;
                }
            }
            return(false);
        }
Ejemplo n.º 49
0
/// <summary>
/// 获得操作系统消息
/// </summary>
/// <param name="m"></param>
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            base.WndProc(ref m);
            if (m.Msg == 0xf || m.Msg == 0x133)
            {
                IntPtr hDC = GetWindowDC(m.HWnd);
                if (hDC.ToInt32() == 0)
                {
                    return;
                }
//只有在边框样式为FixedSingle时自定义边框样式才有效
                if (this.BorderStyle == BorderStyle.FixedSingle)
                {
                    if (_Isempty)
                    {
                        System.Drawing.Pen pen = new Pen(this._BorderColor, 2); //边框Width为2个像素
                        if (this._HotTrack)
                        {
                            if (this.Focused)
                            {
                                pen.Color = this._HotColor;
                            }
                            else
                            {
                                if (this._IsMouseOver)
                                {
                                    pen.Color = this._HotColor;
                                }
                                else
                                {
                                    pen.Color = this._BorderColor;
                                }
                            }
                        }
//绘制边框
                        System.Drawing.Graphics g = Graphics.FromHdc(hDC);
                        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                        g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
                        pen.Dispose();
                    }
                }
                m.Result = IntPtr.Zero; //返回结果
                ReleaseDC(m.HWnd, hDC); //释放
            }
        }
Ejemplo n.º 50
0
            private void OnCustomDraw(ref Message m)
            {
                NativeMethods.NMTVCUSTOMDRAW nmtvcd = (NativeMethods.NMTVCUSTOMDRAW)m.GetLParam(typeof(NativeMethods.NMTVCUSTOMDRAW));

                switch (nmtvcd.nmcd.dwDrawStage)
                {
                case NativeMethods.CDDS_PREPAINT:
                    m.Result = (IntPtr)(NativeMethods.CDRF_NOTIFYITEMDRAW | NativeMethods.CDRF_NOTIFYPOSTPAINT);
                    break;

                case NativeMethods.CDDS_ITEMPREPAINT:
                {
                    TreeNode itemNode = TreeNode.FromHandle(this, (IntPtr)nmtvcd.nmcd.dwItemSpec);
                    if (itemNode != null)
                    {
                        int state     = STATE_NORMAL;
                        int itemState = nmtvcd.nmcd.uItemState;

                        if (((itemState & NativeMethods.CDIS_HOT) != 0) ||
                            ((itemState & NativeMethods.CDIS_FOCUS) != 0))
                        {
                            state |= STATE_HOT;
                        }
                        if ((itemState & NativeMethods.CDIS_SELECTED) != 0)
                        {
                            state |= STATE_SELECTED;
                        }

                        DrawTreeItem(itemNode.Text, itemNode.ImageIndex,
                                     nmtvcd.nmcd.hdc, nmtvcd.nmcd.rc,
                                     state, ColorTranslator.ToWin32(SystemColors.Control), ColorTranslator.ToWin32(SystemColors.ControlText));
                    }
                    m.Result = (IntPtr)NativeMethods.CDRF_SKIPDEFAULT;
                }
                break;

                case NativeMethods.CDDS_POSTPAINT:
                    m.Result = (IntPtr)NativeMethods.CDRF_SKIPDEFAULT;
                    break;

                default:
                    m.Result = (IntPtr)NativeMethods.CDRF_DODEFAULT;
                    break;
                }
            }
Ejemplo n.º 51
0
        /// <summary>
        /// Override ProcessCmdKey method (HotKey processing)
        /// </summary>
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, Keys keyData)
        {
            if (keyData == Keys.F11 && this.ViewMode != CommonData.Mode.View)
            {
                this.btnSaveAndClose.PerformClick();
                return(true);
            }
            if (keyData == Keys.Left && this.ViewMode == CommonData.Mode.View)
            {
                this.btnPrevious.PerformClick();
                return(true);
            }
            if ((keyData == Keys.Right && this.ViewMode == CommonData.Mode.View) || (keyData == Keys.F12 && this.ViewMode == CommonData.Mode.New))
            {
                this.btnSaveAndNext.PerformClick();
                return(true);
            }
            if (keyData == Keys.F12 && this.ViewMode == CommonData.Mode.Edit)
            {
                this.btnSaveAndNext.PerformClick();
                return(true);
            }
            if (keyData == Keys.Escape)
            {
                Exit();
                return(true);
            }
            if ((keyData == Keys.F4 && this.ViewMode == CommonData.Mode.View) ||
                (keyData == Keys.F5 && this.ViewMode != CommonData.Mode.View) ||
                (keyData == Keys.F6 && this.ViewMode == CommonData.Mode.Edit))
            {
                this.btnClear.PerformClick();
                return(true);
            }

            //=====Update 17/05/2013(Kien)=====
            if (keyData == (Keys.Shift | Keys.Tab))
            {
                barManager1.Bars[1].ItemLinks[0].Focus();
                return(true);
            }
            //=====EndUpdate===================

            return(base.ProcessCmdKey(ref msg, keyData));
        }
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            bool handled = false;

            m.Result = IntPtr.Zero;
            if (_br != null && _initialized)
            {
                var _browserWindowHandle = _br.GetBrowserHost().GetWindowHandle();
                if (m.Msg == WM_PARENTNOTIFY)
                {
                    //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-parentnotify
                    //WM_PARENTNOTIFY
                    //Return value
                    //If the application processes this message, it returns zero.
                    //If the application does not process this message, it calls DefWindowProc.
                    if (_browserWindowHandle != IntPtr.Zero)
                    {
                        int loWord = LOWORD((int)m.WParam);
                        switch (loWord)
                        {
                        case WM_LBUTTONDOWN:
                        case WM_MBUTTONDOWN:
                        case WM_RBUTTONDOWN:
                        case WM_XBUTTONDOWN:
                        case WM_POINTERDOWN:
                            handled = true;
                            IntPtr focusedControl = GetFocus();
                            if (focusedControl != _browserWindowHandle)
                            {
                                SetFocus(_browserWindowHandle);
                            }
                            break;

                        default:
                            break;
                        }
                    }
                }
            }

            if (!handled)
            {
                base.WndProc(ref m);
            }
        }
Ejemplo n.º 53
0
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            const int WM_COPYDATA = 0x004A;

            switch (m.Msg)
            {
            case WM_COPYDATA:
                COPYDATASTRUCT cds     = new COPYDATASTRUCT();
                Type           cdsType = cds.GetType();
                cds = (COPYDATASTRUCT)m.GetLParam(cdsType);
                if (cds.dwData == IntPtr.Zero)
                {    // URWPGSim2DServer程序中按下的是End按钮则结束录像
                    btnStop_Click(null, null);
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }
                else
                {    // URWPGSim2DServer程序中按下的是Video按钮则将发送的参数设置到Screencast界面
                    // 从收到的字符串分离录像区域左上角坐标/宽度高度/
                    // URWPGSim2D主窗口句柄/录像保存完整文件名
                    int x = Convert.ToInt32(cds.lpData.Substring(0, 6));
                    int y = Convert.ToInt32(cds.lpData.Substring(6, 6));
                    int w = Convert.ToInt32(cds.lpData.Substring(12, 6));
                    int h = Convert.ToInt32(cds.lpData.Substring(18, 6));
                    txtX.Text        = x.ToString();
                    txtY.Text        = y.ToString();
                    txtWidth.Text    = w.ToString();
                    txtHeight.Text   = h.ToString();
                    hWndURWPGSim2D   = Convert.ToInt32(cds.lpData.Substring(24, 10));
                    txtFileName.Text = cds.lpData.Substring(34);
                    if (txtFileName.Text.LastIndexOf('.') != (txtFileName.Text.Length - 4))
                    {    // 倒数第4个字符不是'.'则表明发送过来的文件名超长被截掉了一部分采用默认文件名
                        txtFileName.Text = Application.StartupPath + "\\test.wmv";
                    }
                    this.Location = new Point(x + (w - this.Width) / 2, y + (h - this.Height) / 2);
                }
                // 显示Screencast程序主窗口
                this.WindowState = FormWindowState.Normal;
                this.TopMost     = true;
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
Ejemplo n.º 54
0
 public override void ProcessWindowMessage(ref System.Windows.Forms.Message m)
 {
     if (m.Msg == _MsgID_MouseLL)
     {
         /*
          * if (MouseLLEvent != null)
          *  MouseLLEvent(m.WParam, m.LParam);
          * MSLLHOOKSTRUCT M = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(m.LParam, typeof(MSLLHOOKSTRUCT));
          *
          * if (m.WParam.ToInt32() == WM_MOUSEMOVE)
          * {
          *  if (MouseMove != null)
          *      MouseMove(this, new MouseEventArgs(MouseButtons.None, 0, M.pt.X, M.pt.Y, 0));
          * }
          * else if (m.WParam.ToInt32() == WM_LBUTTONDOWN)
          * {
          *  if (MouseDown != null)
          *      MouseDown(this, new MouseEventArgs(MouseButtons.Left, 0, M.pt.X, M.pt.Y, 0));
          * }
          * else if (m.WParam.ToInt32() == WM_RBUTTONDOWN)
          * {
          *  if (MouseDown != null)
          *      MouseDown(this, new MouseEventArgs(MouseButtons.Right, 0, M.pt.X, M.pt.Y, 0));
          * }
          * else if (m.WParam.ToInt32() == WM_LBUTTONUP)
          * {
          *  if (MouseUp != null)
          *      MouseUp(this, new MouseEventArgs(MouseButtons.Left, 0, M.pt.X, M.pt.Y, 0));
          * }
          * else if (m.WParam.ToInt32() == WM_RBUTTONUP)
          * {
          *  if (MouseUp != null)
          *      MouseUp(this, new MouseEventArgs(MouseButtons.Right, 0, M.pt.X, M.pt.Y, 0));
          * }
          *
          */
     }
     else if (m.Msg == _MsgID_MouseLL_HookReplaced)
     {
         if (HookReplaced != null)
         {
             HookReplaced();
         }
     }
 }
Ejemplo n.º 55
0
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            const int WM_NCPAINT = 0x85;

            switch (m.Msg)
            {
            case WM_NCPAINT:
                base.WndProc(ref m);
                if (_rectangeUpdated)
                {
                    IntPtr hdc = GetWindowDC(m.HWnd);
                    if ((int)hdc != 0)
                    {
                        Graphics g = Graphics.FromHdc(hdc);
                        g.DrawImage(Properties.Resources.Welcome_Scan, _rectange);
                        g.DrawLine(new Pen(Color.Blue), new Point(1, 1), new Point(50, 50));
                        g.Flush();
                        ReleaseDC(m.HWnd, hdc);
                        _rectangeUpdated = false;
                    }
                }
                break;

            case WM_NCCALCSIZE:
            {
                base.WndProc(ref m);
                if (m.WParam != IntPtr.Zero && _titleHight != 0)
                {
                    if (m.HWnd == this.Handle)
                    {
                        NCCALCSIZE_PARAMS rcsize = (NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam, typeof(NCCALCSIZE_PARAMS));
                        _rectange        = new Rectangle(_borderWidth, _titleHight, rcsize.rcNewWindow.right - rcsize.rcNewWindow.left, rcsize.rcNewWindow.bottom - rcsize.rcNewWindow.top);
                        _rectangeUpdated = true;
                    }
                }

                m.Result = new IntPtr(1);
            }
            break;

            default:
                base.WndProc(ref m);
                break;
            }
        }
Ejemplo n.º 56
0
        protected override void WndProc(ref swf.Message m)
        {
            if (ExtendedMode && m.Msg == (int)Win32.WM.LBUTTONDOWN)
            {
                var mouse = PointToClient(MousePosition);

                if (Enabled)
                {
                    using (var g = CreateGraphics())
                    {
                        var offset = 2;
                        if (ShowCheckBox)
                        {
                            var checkSize   = swf.CheckBoxRenderer.GetGlyphSize(g, swf.VisualStyles.CheckBoxState.UncheckedNormal);
                            var checkOffset = (ClientSize.Height - checkSize.Height) / 2;
                            offset += checkOffset + checkSize.Width + 1;
                        }

                        if (Checked)
                        {
                            var test = mouse;
                            test.X -= offset;
                            for (int i = 0; i < segments.Count; i++)
                            {
                                var segment = segments[i];
                                if (test.X >= segment.Start && test.X <= segment.End)
                                {
                                    Focus();
                                    selectedSegment = i;
                                    Invalidate();
                                    return;
                                }
                            }
                        }

                        if (mouse.X > offset && mouse.X < ClientSize.Width - img.Width - 14)
                        {
                            Focus();
                            return;
                        }
                    }
                }
            }
            base.WndProc(ref m);
        }
Ejemplo n.º 57
0
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, Keys keyData)
        {
            switch (keyData)
            {
            case Keys.F1:
                btnFloorSave_Click(null, null);
                return(true);

            case Keys.F2:
                btnParkAdd_Click(null, null);
                return(true);

            case Keys.F3:
                btnParkDelete_Click(null, null);
                return(true);

            case Keys.F4:
                btnAreaSave_Click(null, null);
                return(true);

            case Keys.F5:
                btnAreaAdd_Click(null, null);
                return(true);

            case Keys.F6:
                btnAreaDelete_Click(null, null);
                return(true);

            case Keys.F7:
                btnParkSave_Click(null, null);
                return(true);

            case Keys.F8:
                btnParkAdd_Click(null, null);
                return(true);

            case Keys.F9:
                btnParkDelete_Click(null, null);
                return(true);

            default:
                break;
            }
            return(base.ProcessCmdKey(ref msg, keyData));
        }
        /// <summary>
        /// 窗口之间消息
        /// </summary>
        /// <param name="m"></param>
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case 601:
                this.Activate();

                string msg = ShareData.Msg[m.WParam.ToInt32()].ToString();    //分为两段,FORM编号+返回结果(字符串:true或错误结果)
                if (_taskid == null || _taskid.Trim().Length == 0)
                {
                    ComitDoControl(true);
                    return;
                }
                GSSModel.Tasks task = new GSSModel.Tasks();
                task.F_ID        = int.Parse(_taskid);
                task.F_EditMan   = int.Parse(ShareData.UserID);
                task.F_EditTime  = DateTime.Now;
                task.F_TToolUsed = true;
                task.F_TUseData  = "清空防沉迷工具-清空防沉迷" + "\n" + lblUR.Text + "\n";
                task.F_Note      = rtboxNote.Text;
                _isToolUsed      = true;
                if (msg == "true")
                {
                    task.F_TUseData += " 清空防沉迷成功!";
                    _clihandle.EditTaskNoReturn(task);
                    MsgBox.Show("清空防沉迷成功!", LanguageResource.Language.Tip_Tip, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Close();
                }
                else
                {
                    task.F_TUseData += " 清空防沉迷失败!" + msg;
                    MsgBox.Show("清空防沉迷失败!" + msg, LanguageResource.Language.Tip_Tip, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    _clihandle.EditTaskNoReturn(task);
                    ComitDoControl(true);
                }

                base.DefWndProc(ref m);
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
Ejemplo n.º 59
0
        public bool PreFilterMessage(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case WM_KEYDOWN:
                //Trace.WriteLine("KD")
                switch (m.WParam.ToInt32())
                {
                case (int)Keys.F12:
                    if (ToggleF12KeyboardEvent != null)
                    {
                        ToggleF12KeyboardEvent();
                        //return true;
                    }
                    //Trace.WriteLine("F12");
                    break;

                case (int)Keys.F11:
                    if (ToggleF11KeyboardEvent != null)
                    {
                        ToggleF11KeyboardEvent();
                        //return true;
                    }
                    //Trace.WriteLine("F11");
                    break;
                }

                break;

            case WM_KEYUP:
                break;
            //Trace.WriteLine("KU")

            case WM_SYSKEYDOWN:
                break;
            //Trace.WriteLine("SKD")

            case WM_SYSKEYUP:
                break;
                //Trace.WriteLine("SKU")
            }

            // Pass the message along to the application.
            return(false);
        }
Ejemplo n.º 60
0
        private void OnWMNCCalcSize(ref System.Windows.Forms.Message m)
        {
            if (!this.EnableNCModification)
            {
                base.WndProc(ref m);
                return;
            }

            if (m.WParam == new IntPtr(1))
            {
                NativeMethods.NCCALCSIZE_PARAMS ncCalcSizeParams = new NativeMethods.NCCALCSIZE_PARAMS();
                ncCalcSizeParams = (NativeMethods.NCCALCSIZE_PARAMS)
                                   Marshal.PtrToStructure(m.LParam, typeof(NativeMethods.NCCALCSIZE_PARAMS));

                Padding calculatedClientMargin = this.GetNCMetrics();

                ncCalcSizeParams.rgrc[0].top    += calculatedClientMargin.Top;
                ncCalcSizeParams.rgrc[0].left   += calculatedClientMargin.Left;
                ncCalcSizeParams.rgrc[0].right  -= calculatedClientMargin.Right;
                ncCalcSizeParams.rgrc[0].bottom -= calculatedClientMargin.Bottom;

                Marshal.StructureToPtr(ncCalcSizeParams, m.LParam, true);

                m.Result = IntPtr.Zero;
            }
            else
            {
                base.WndProc(ref m);

                NativeMethods.RECT ncCalcSizeParams = new NativeMethods.RECT();
                ncCalcSizeParams = (NativeMethods.RECT)
                                   Marshal.PtrToStructure(m.LParam, typeof(NativeMethods.RECT));


                Padding calculatedClientMargin = this.GetNCMetrics();

                ncCalcSizeParams.top    += calculatedClientMargin.Top;
                ncCalcSizeParams.left   += calculatedClientMargin.Left;
                ncCalcSizeParams.right  -= calculatedClientMargin.Right;
                ncCalcSizeParams.bottom -= calculatedClientMargin.Bottom;

                Marshal.StructureToPtr(ncCalcSizeParams, m.LParam, true);
                m.Result = IntPtr.Zero;
            }
        }