SetGestureConfig function
Syntax
BOOL WINAPI SetGestureConfig(
_In_ HWND hwnd,
_In_ DWORD dwReserved,
_In_ UINT cIDs,
_In_ PGESTURECONFIG pGestureConfig,
_In_ UINT cbSize
);
Parameters
hwnd [in]
A handle to the window to set the gesture configuration on.
dwReserved [in]
This value is reserved and must be set to 0.
cIDs [in]
A count of the gesture configuration structures that are being passed.
pGestureConfig [in]
An array of gesture configuration structures that specify the gesture configuration.
cbSize [in]
The size of the gesture configuration (GESTURECONFIG) structure.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, use the GetLastError function.
Remarks
If you don't expect to change the gesture configuration, call SetGestureConfig at window creation time. If you want to dynamically change the gesture configuration, call SetGestureConfig in response to WM_GESTURENOTIFY messages.
The following table shows the identifiers for gestures that are supported by the dwID member of the GESTURECONFIG structure. Note that setting dwID to 0 indicates that global gesture configuration flags are set.
Name
Value
Description
GID_ZOOM
삼
Configuration settings for the zoom gesture.
GID_PAN
사
The pan gesture.
GID_ROTATE
오
The rotation gesture.
GID_TWOFINGERTAP
육
The two-finger tap gesture.
GID_PRESSANDTAP
칠
The press and tap gesture.
The following flags are used when dwID is set to zero.
Name
Value
Description
GC_ALLGESTURES
0x00000001
All of the gestures.
The following flags are used when dwID is set to GID_ZOOM.
Name
Value
Description
GC_ZOOM
0x00000001
The zoom gesture.
The following flags are used when dwID is set to GID_PAN.
Name
Value
Description
GC_PAN
0x00000001
All pan gestures.
GC_PAN_WITH_SINGLE_FINGER_VERTICALLY
0x00000002
Vertical pans with one finger.
GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY
0x00000004
Horizontal pans with one finger.
GC_PAN_WITH_GUTTER
0x00000008
Panning with a gutter boundary around the edges of pannable region. The gutter boundary limits perpendicular movement to a primary direction until a threshold is reached to break out of the gutter.
GC_PAN_WITH_INTERTIA
0x00000010
Panning with inertia to smoothly slow when pan gestures stop.
Note Pan gestures can be used in conjunction with each other to control behavior. For example, setting the dwWant bits to panning with single-finger horizontal and setting the dwBlock bits to single-finger vertical will restrict panning to horizontal pans. Changing the dwWant bit to have
GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY
and removing single-finger vertical pan from the dwBlock bit will enable both vertical and horizontal panning. Note By default, panning has inertia enabled.
Note A single call to SetGestureConfig cannot include other GIDs along with 0.
The following flags are used when dwID is set to GID_ROTATE.
Name
Value
Description
GC_ROTATE
0x00000001
The rotation gesture.
The following flags are used when dwID is set to GID_TWOFINGERTAP.
Name
Value
Description
GC_TWOFINGERTAP
0x00000001
The two-finger tap gesture.
The following flags are used when dwID is set to GID_PRESSANDTAP.
Name
Value
Description
GC_PRESSANDTAP
0x00000001
The press and tap gesture.
Note Calling SetGestureConfig will change the gesture configuration for the lifetime of the Window, not just for the next gesture.
Examples
The following example shows how you could receive horizontal and vertical single-finger panning with no gutter and no inertia. This is a typical configuration for a 2-D navigation application such as the Microsoft PixelSense Globe application.
// set up our want / block settings
DWORD dwPanWant = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
DWORD dwPanBlock = GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA;
// set the settings in the gesture configuration
GESTURECONFIG gc[] = {{ GID_ZOOM, GC_ZOOM, 0 },
{ GID_ROTATE, GC_ROTATE, 0},
{ GID_PAN, dwPanWant , dwPanBlock}
};
UINT uiGcs = 3;
BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG));
if (!bResult){
DWORD err = GetLastError();
}
The following example shows how to receive single-finger pan gestures and disable gutter panning. This is a typical configuration for applications that scroll text such as Notepad.
Note You should explicitly set all the flags that you want enabled or disabled when controlling single-finger panning.
// set up our want / block settings
DWORD dwPanWant = GC_PAN | GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
DWORD dwPanBlock = GC_PAN_WITH_GUTTER;
// set the settings in the gesture configuration
GESTURECONFIG gc[] = {{ GID_ZOOM, GC_ZOOM, 0 },
{ GID_ROTATE, GC_ROTATE, 0},
{ GID_PAN, dwPanWant , dwPanBlock}
};
UINT uiGcs = 3;
BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG));
if (!bResult){
DWORD err = GetLastError();
}
The following example shows how you can disable all gestures.
// set the settings in the gesture configuration
GESTURECONFIG gc[] = {0,0,GC_ALLGESTURES};
UINT uiGcs = 1;
BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG));
if (!bResult){
DWORD err = GetLastError();
}
The following example shows how you could enable all gestures.
GESTURECONFIG gc = {0,GC_ALLGESTURES,0};
UINT uiGcs = 1;
BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, &gc, sizeof(GESTURECONFIG));
if (!bResult){
DWORD err = GetLastError();
}
The following example shows how you could enable all Windows 7 gestures.
// set the settings in the gesture configuration
GESTURECONFIG gc[] = {{ GID_ZOOM, GC_ZOOM, 0 },
{ GID_ROTATE, GC_ROTATE, 0},
{ GID_PAN, GC_PAN , 0},
{ GID_TWOFINGERTAP, GC_TWOFINGERTAP , 0},
{ GID_PRESSANDTAP, GC_PRESSANDTAP , 0}
};
UINT uiGcs = 5;
BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG));
if (!bResult){
DWORD err = GetLastError();
}
The following example configuration would set the parent window to enable support for zoom, horizontal pan, and vertical pan while the child window would just support horizontal pan.
// set up our want / block settings for a parent window
DWORD dwPanWant = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
DWORD dwPanBlock = GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA;
// set the settings in the gesture configuration
GESTURECONFIG gcParent[] = {{ GID_ZOOM, GC_ZOOM, 0 },
{ GID_PAN, dwPanWant , dwPanBlock}
};
// Set the pan settings for a child window
dwPanWant = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA;
GESTURECONFIG gcChild[] = {{ GID_ZOOM, 0, GC_ZOOM },
{ GID_PAN, dwPanWant , dwPanBlock}
};
UINT uiGcs = 2;
BOOL bResult = FALSE;
if (isParent){
bResult = SetGestureConfig(hWnd, 0, uiGcs, gcParent, sizeof(GESTURECONFIG));
}else{
bResult = SetGestureConfig(hWnd, 0, uiGcs, gcChild, sizeof(GESTURECONFIG));
}
if (!bResult){
DWORD err = GetLastError();
}
Requirements
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
Windows Server 2008 R2 [desktop apps only]
Header
Winuser.h (include Windows.h)
Library
User32.lib
DLL
User32.dll
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[WinIoT/라즈파이] VS2019로 만든 UWP의 sln을 라즈파이 3+WinIoTCore로 원격 디버깅을 할 수 없을 때의 대처2021년 1월 시점에서 라즈파이 3에 WindowsIoTCore를 넣고 VisualStudio2019에서 UWP 앱을 새로 만들고 디버깅하려고 했는데 잘 디버깅할 수 없었다. 구체적으로는, 「리모트 디버거에 접속할...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.