当前位置: 首页>>代码示例>>C#>>正文


C# Message.GetPointerLocation方法代码示例

本文整理汇总了C#中System.Windows.Forms.Message.GetPointerLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetPointerLocation方法的具体用法?C# Message.GetPointerLocation怎么用?C# Message.GetPointerLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Message的用法示例。


在下文中一共展示了Message.GetPointerLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WndProc

        protected override void WndProc(ref Message m)
        {
            var state = TouchLocationState.Invalid;
           
            switch (m.Msg)
            {
                case WM_SYSCOMMAND:
                    // Disable the system menu from being toggled by
                    // keyboard input so we can own the ALT key.
                    if (m.WParam.ToInt32() == 0xF100) // SC_KEYMENU
                    {
                        m.Result = IntPtr.Zero;
                        return;
                    }
                    break;

                case WM_POINTERUP:
                    state = TouchLocationState.Released;
                    break;
                case WM_POINTERDOWN:
                    state = TouchLocationState.Pressed;
                    break;
                case WM_POINTERUPDATE:
                    state = TouchLocationState.Moved;
                    break;
            }

            if (state != TouchLocationState.Invalid)
            {
                var id = m.GetPointerId();

                var position = m.GetPointerLocation();
                position = PointToClient(position);
                var vec = new Vector2(position.X, position.Y);

                TouchPanel.AddEvent(id, state, vec, false);
            }

            base.WndProc(ref m);
        }
开发者ID:jonathanpeppers,项目名称:MonoGameOrientation,代码行数:40,代码来源:WinFormsGameForm.cs

示例2: WndProc

        protected override void WndProc(ref Message m)
        {
            var state = TouchLocationState.Invalid;

            if (m.Msg == WM_POINTERUP)
                state = TouchLocationState.Released;
            else if (m.Msg == WM_POINTERDOWN)
                state = TouchLocationState.Pressed;
            else if (m.Msg == WM_POINTERUPDATE)
                state = TouchLocationState.Moved;

            if (state != TouchLocationState.Invalid)
            {
                var id = m.GetPointerId();

                var position = m.GetPointerLocation();
                position = PointToClient(position);
                var vec = new Vector2(position.X, position.Y);

                TouchPanel.AddEvent(id, state, vec, false);
            }

            base.WndProc(ref m);
        }
开发者ID:bwfox,项目名称:MonoGame,代码行数:24,代码来源:WinFormsGameForm.cs

示例3: WndProc

        protected override void WndProc(ref Message m)
        {
            var state = TouchLocationState.Invalid;
           
            switch (m.Msg)
            {
                case WM_TABLET_QUERYSYSTEMGESTURESTA:
                    {
                        // This disables the windows touch helpers, popups, and 
                        // guides that get in the way of touch gameplay.
                        const int flags = 0x00000001 | // TABLET_DISABLE_PRESSANDHOLD
                                          0x00000008 | // TABLET_DISABLE_PENTAPFEEDBACK
                                          0x00000010 | // TABLET_DISABLE_PENBARRELFEEDBACK
                                          0x00000100 | // TABLET_DISABLE_TOUCHUIFORCEON
                                          0x00000200 | // TABLET_DISABLE_TOUCHUIFORCEOFF
                                          0x00008000 | // TABLET_DISABLE_TOUCHSWITCH
                                          0x00010000 | // TABLET_DISABLE_FLICKS
                                          0x00080000 | // TABLET_DISABLE_SMOOTHSCROLLING 
                                          0x00100000; // TABLET_DISABLE_FLICKFALLBACKKEYS
                        m.Result = new IntPtr(flags);
                        return;
                    }
#if (WINDOWS && DIRECTX)
                case WM_KEYDOWN:
                    switch (m.WParam.ToInt32())
                    {
                        case 0x5B:  // Left Windows Key

                            if (this.WindowState == FormWindowState.Maximized)
                            {
                                this.WindowState = FormWindowState.Minimized;
                            }
 		 
                            break;
                        case 0x5C: // Right Windows Key
                            goto case 0x5B;
                    }
                    break;
#endif
                case WM_SYSCOMMAND:

                    var wParam = m.WParam.ToInt32();

                    if (!AllowAltF4 && wParam == 0xF060 && m.LParam.ToInt32() == 0 && Focused)
                    {
                        m.Result = IntPtr.Zero;
                        return;
                    }

                    // Disable the system menu from being toggled by
                    // keyboard input so we can own the ALT key.
                    if (wParam == 0xF100) // SC_KEYMENU
                    {
                        m.Result = IntPtr.Zero;
                        return;
                    }
                    break;

                case WM_POINTERUP:
                    state = TouchLocationState.Released;
                    break;
                case WM_POINTERDOWN:
                    state = TouchLocationState.Pressed;
                    break;
                case WM_POINTERUPDATE:
                    state = TouchLocationState.Moved;
                    break;
            }

            if (state != TouchLocationState.Invalid)
            {
                var id = m.GetPointerId();

                var position = m.GetPointerLocation();
                position = PointToClient(position);
                var vec = new Vector2(position.X, position.Y);

                _window.TouchPanelState.AddEvent(id, state, vec, false);
            }

            base.WndProc(ref m);
        }
开发者ID:Cardanis,项目名称:MonoGame,代码行数:82,代码来源:WinFormsGameForm.cs


注:本文中的System.Windows.Forms.Message.GetPointerLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。