本文整理汇总了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);
}
示例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);
}
示例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);
}