This program uses winforms and c# (no wpf). I have a panel with buttons on it and getting it to scroll is no problem. However, when the program is on a hi-resolution touch screen -- like a Surface 7 -- trying to touch in the exact right spot to get it to scroll is hit and miss. I've searched and have yet to find a way to make the grab area (so to speak) of a vertical scroll bar wider so that when you touch the screen, the control actually picks up the event. Any ideas on how to do this?
If your application is DPI unaware, then it is enough to set the scrollbar width to SystemInformation.VerticalScrollBarWidth.
Related
I'm planning the development of a fairly simple app and have little experience with UWP, some with Winforms. I'd like to make it so that the user can dock the app (similar to the taskbar, but the size of a browser tab) to the edge of the screen and allow it to slide in/out on click or hover. Searches have turned up nothing (maybe I'm not using the right terms) and I've yet to see this functionality on a Windows 10 app.
I'm thinking that I could just force the window to be offscreen or have a 0 width. But I'm not certain how to make a tab appear when that happens. Would I make a second window that is the tab?
All constructive thoughts and ideas are welcome.
I have a program that currently launches a winform in full screen, hiding the task bar.
If I manage to keep fiddling with the cordinates to get a text label to sit in the bottom right corner of the screen. will it always appear there regardless of what size screen or computer is running the program?
In the label properties, set the Anchor from Top Left to Bottom Right.
I'm working on a class that descends from the WPF Window class that implements the Application Toolbar functionality available in the Window 7 + shell (that is, it calls the Win32 SHAppBarWindow to dock to an edge of the desktop and undock). The idea is that you can drag the window around the screen and when it is within some distance of a desktop edge, it docks itself.
Because of the need to call the Win32 SHAppbarWindow function, and because working through WPF events is just not helpful, I've written a window procedure that works at the Win32 level & is hooked in using the HwndSource.AddHook method. This procedure gets called first and processes anything it needs to process, and passes the rest on to WPF.
I've been working on the dragging logic and I'd like to give the user a visual indication that the window could dock itself to the edge it's closest to, without actually docking it. To that end, I'd like to display a transparent rectangle with a dashed border the size that the window would be after docking in the location it would be. If the user releases the left mouse button at that point, then the window would actually be docked at that edge. Once the mouse is moved away from that edge, the rectangle would go away.
I know how to compute the rectangle's size & location. But how do I display the rectangle? I'm pretty sure I'd have to do it with GDI32 calls, as the target area is outside the window's nonclient & client areas. But how would I draw the rectangle, without messing up the other windows that might be in that area?
I would like to use a ScrollBar in my app but I don't want the default end-arrows showing up; I want to be able to use other "external" controls for activating the scroll bar. Any ideas?
Please don't - scrollbar arrows are an essential accessibility feature when a document is too long to scroll by dragging the scrollbar and when a user lacks a mousewheel or the means to use it, then the only way to scroll is by clicking on the arrow buttons.
(Apple gets away with it because all of their modern hardware supports touch-scrolling, but us on the Windows camp don't have that luxury)
Specifically, what I am try to is overlap my element on top of everything, including the desktop, similar to the taskbar in Windows. I have a Windows Form Control that looks kind of like a tab. its like 50px wide by like 150px in length. What I would like to do is have that control appear in front of all windows, including the desktop itself. I say "dock-like" because I belive docking pushes windows over (so if my tab was docked, it would push any full screen application window over 50px), which is not what I'm trying to do. I want my tab to overlay on top of everything. The closest example I can think of is Winamp. Winamp can dock to the top of the screen and it is always on top of any application.
how can do this in C#?
System.Windows.Forms.Form has a property, TopMost, which will cause the form to stay on top of other windows.
The "snapping" behavior of Winamp can be implemented by using the Move event of the form--when the form is moved close enough to the edge of the screen, programatically set the position so that it's on the edge.