Windows Form Application Touch Gesture - c#

We are developing a C#, .NET 4.5 application. On Windows 8.1, whenever a user does touch scrolling on one of the panels in the form, the entire screen application moves just a bit, even if maximized.
Found questions asked where people having similar issues fixed it in WPF by turning off the boundary feedback event, and people who fixed it in Windows 7 by just turning off boundary feedback for all of Windows. However, I can't find anything for disabling this in a standard C# windows form application, and the boundary feedback setting option doesn't seem to exist in the Windows 8 settings.
Any suggestions?
Thanks

I haven't tried this, but I believe you can override the WM_GESTURE message (specifically GID_PAN) and not send it on.
The default code is likely very similar to the example code in UpdatePanningFeedback .

Related

How to disable touch scrolling in WinForms for Windows 10?

Years ago we have developed a WinForms application that was running with Windows 7, but should now run with Windows 10. This application is used on touch screens.
In Windows 7, the user could only scroll DataGridViews and other things using the scrollbar. Since this application is running with Windows 10, the user can also scroll these controls by swiping/dragging the control.
However, we don't want to change the behavior of this application now it is running with a newer Windows version, so we don't want to have this 'touch scrolling' functionality. Only the scrollbars may be used to scroll.
WPF has better touch support for these kind of things (PanningMode on ScrollViewers etc.), but unfortunately we can't migrate this application from WinForms to WPF.
So is there a way to disable this touch scrolling in code for WinForms? Or can it be disabled system wide with a Windows 10 setting or somewhere in the registry?
Thanks!
A colleague found a solution.
In the registry, find key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wisp\Touch\PanningDisabled and set it to 1. Without rebooting, swiping will be disabled.

WPF Application with OnScreenKeyboard on Windows Tablet

I am building a WPF Application that is going to be used on Desktop as well as on a Surface Pro Tablet running the Win10 Creators Update.
If a Textbox gets Focus the onscreenkeyboard of Win10 should open on the bottom of the screen and move the application up the screen to push the focused element back into view.
I have implemented WpfTabTib which worked pretty well until we updated the tablet to the creators version. Technically it is still working but with an ugly animation moving the window up, down and up again to open the keyboard.
Having read that microsoft adjusted the behaviour of the keyboard to match the uwp behaviour I have updated my .Net framework to 4.6.2 without the hoped result. It seems Microsoft doesn't care for this behaviour.
Does anyone have the same problem or an different approach for me ?
Thanks a lot!
Edit: Updating the Tablet to an Insider Preview of the coming Windows Fall Update changed the behaviour again: The opening animation is now a little better, but still far from nice. And as new problem closing the osk doesn't move the application back down.

How do I invoke or dismiss the touch keyboard in WPF using .NET 4.6.2?

Microsoft's release notes for .NET Framework 4.6.2 includes the following:
"Soft Keyboard support enables automatic invocation and dismissal of the touch keyboard in WPF applications without disabling WPF stylus/touch support on Windows 10. Prior to 4.6.2, WPF applications do not implicitly support the invocation or dismissal of the touch keyboard without disabling WPF stylus/touch support. This is due to a change in the way the touch keyboard tracks focus in applications starting in Windows 8."
The List of Changes likewise states:
"Enable automatic invocation and dismissal of the touch keyboard in WPF applications without disabling WPF stylus/touch support on Windows 10 [178044]"
But I cannot find any indication of HOW to do this, and I cannot find anything in the official API diff that seems to be this.
Can anyone help me find documentation of how to do this thing that I can now allegedly do?
My context is that I have an application that explicitly launches "OSK.exe" when needed. On touch devices with a built-in Windows on-screen keyboard, this results in TWO on-screen keyboards being shown. I want to disable the standard one and only launch "OSK.exe" explicitly.
Thanks!
I think this (especially the comments) should answer your question. The short story is: there is nothing specific to do, but it works only on Win10 anniversary edition.
To disable the soft keyboard, you can do what's indicate in the comments:
WPF on Windows 7 with touch: hide soft keyboard (and the popup icon that enables it)
or
https://blogs.msdn.microsoft.com/winuiautomation/2015/04/26/how-and-why-i-added-an-on-screen-keyboard-to-my-windows-store-app/
If in WPF on Windows 10 anniversary edition, you can override automation peer in TextBox:
protected override AutomationPeer OnCreateAutomationPeer()
{
return new FrameworkElementAutomationPeer(this);
}
On Windows 7 it is enough to put
InputMethod.IsInputMethodEnabled=”False”
Hope it helps.

Windows CE 6.0 (OEM 5.37) not displayed hourglass cursor

I have a problem with displaying the hourglass and custom cursors in Windows CE applications on OEM 5 platform. Question is that the cursor does not display by default, and is displayed only when I click on the screen.
Interestingly, the hourglass cursor spins correctly on OEM 4 platform.
I think, that in OEM 5, UI would updated only by actions outside.
What can be done so that the cursor will update correctly at the screen?
I had a similar issue. Here so far what I know and what solutions you have:
In some mobile operating systems the wait-cursor is very sensitive. When you activate him twice (without deactivating him) he will not appear again.
Also there are CE-Devices where a wait-cursor won't show up.
You could disable all controls when you are processing something
You can also put a wait-image or a wait-label in the middle of the screen instead of using the wait-cursor.
My colleagues and I spent lots of hours on these buggy wait-cursors under windows ce. Finally we gave up and used this solutions I mentioned.

My GUI renders differntly on one of the computers I run it on

I have a .Net application that was originally created in Visual Studio Professional 2005, using the .Net 2.0 framework.
Recently, I have opened the project in Visual C# Express 2010, made some minor changes, and built it using .Net framework 4.0.
Everything works like a charm except for one quite annoying part. When I am running the application on a HP EliteBook 8740w, with a 1920x1200 screen, a group of GUI controls get shuffled around, so that they land on top of eachother. This error does not show up when running on my Windows 7 64 bit workstation with external display of 1900x1080 resolution. Neither does it show when running on a Windows XP laptop with 1024x768 resolution.
I have tried to connect a 1600x1200 external display to the EliteBook, but the error shows up there also.
The controls that get messed up are a set of comboboxes, numericUpAndDowns, and labels, laid out in a table layout container, that in turn is placed on a tab page in a tab page control.
I have tried creating a new tab page control and table layout container from scratch, and then moving the comboboxes etc into the new table layout container, but the error prevails.
I would really appreciate some help in this matter, because I don't know what else to try. I am starting to suspect that there is something wrong with the graphics on the EliteBook, but, then again, everything else renders nicely on its screen.
Thanks,
Fredrik Israelsson
--- Edit ---
Thank you for your quick answers. Before I had a chance to look at them, I think I solved the problem by myself. Stumbled upon a thread about why Visual Studio automatically changes sizes of controls although one has set anchor and dock properties to None. One of the answers mentioned the AutoScaleMode property. I changed AutoScaleMode from Font to None on my main application Window, and no the GUI renders nicely on all my computers.
Thanks again!
/Fredrik Israelsson
I suspect that this is because the two machines have different DPI settings. This is always a pain with Windows Forms.
Here are a few links that might help.
http://msdn.microsoft.com/en-us/library/ms229605.aspx
http://www.sellsbrothers.com/writing/winformsAutoScaling.htm
It could be related to Hardware Acceleration. Is your application a WinForms or a WPF one?
I have faced really odd behaviors when using VS2010 on Win7 64 bit only because it was trying to use Hardware Acceleration when I built the app.
Improving Performance by Changing the Visual Experience
You might have a problem with Hardware Acceleration in VS2010. I had an issue with rendering applications built using WPF because of this.
Give it a try: http://blogs.msdn.com/b/zainnab/archive/2010/06/22/improving-performance-by-changing-the-visual-experience-vstipenv0017.aspx
And if that doesn't fix your issue, go to your video card settings (nvidia or amd catalyst) and do a "reset settings" on the computer where the app doesn't correctly paint itself. Then try again.

Categories