I have a form with a Transparency-key color, where I'm doing a global mouse hook for the right click.
Until there everything is okay, but since the form is transparent, the mouse cursor is changing according to what is behind the form.
Is there any way to change the global mouse cursor?
Yup, that's how transparency works. Not just to the eye of the user, also to what the mouse sees from its left eye. Has to work that way, major user confusion if it didn't, no option to change it.
The workaround is to show a fake version of the desktop. A screen shot. Just what the ever popular Windows Snipping Tool does. Sample code is in this thread.
Related
I'm writing a screen shot app where I need to prevent the mouse over effect in all windows. For example, when hovering over a button or hyperlink they will often change color as a form of feedback. My goal is to take a screen shot where the user clicks without the additional feedback.
I can see two approaches:
Disable / ignore the system cursor and create my own. Allow it to fly around the screen without triggering any hover effects. Send a mouse_event when the user clicks using winuser.h
Use a semi-transparent topmost WPF window that allows clicks pass through to other windows. THis answer feels close, but does trigger hover over effects in other windows.
Option 1 is feasible, but I would need to also account for right clicking and scroll wheel.
Option 2 would be best if I could pass through the click event and not the mouse movement. Is this possible in WPF or should I roll my own cursor controls?
Thanks!
I have some tiles layed out as buttons in my app. Im not that good at xaml and hope someone here can guide or show how i come around making them behave alittle like the tiles in the start screen of windows.
I have with some template set. How can i add the little border when mouse is moved over it and how do i make it look like it gets pushed down when clicked.
my button is just a sqare box with a background color.
You have to edit the Control template for Button. And add an additional border which should appear on Pointer over state. Write your own animation in Visual State manager to achieve this. To make this more easier just open your project in Expression Blend. Right click the button and choose edit template. the default template will fell into resources, so that you can just modify.
http://msdn.microsoft.com/en-us/library/cc294908.aspx
To perform a push effect, need to animate Scale Transform in pointer pressed state.
Regards,
I have a fullscreen application running on Windows CE 6.0 which will only be manipulated using the finger or a stylus.
So I don't need the mouse cursor, which I'm hiding using Cursor.Hide().
However, when I use the stylus to manipulate something on the screen, the mouse cursor is printed while the stylus touch the screen.
Is there a way to make the cursor not show when touching the screen?
BTW: the application will be the only thing running, so system-wide solution are possible, but I'd rather keep it inside the application.
For a system-wide solution, in case you can create the OS, you can remove the mouse cursor component from the catalog (SYSGEN_CURSOR).
For a local solution here is a suggestion (never tried it):
You can replace the icon with a blank icon so you won't see any cursor while inside your form. Once you leave the borders of your form you can restore the usual icon.
Read How to use custom cursors. I checked that the Cursor class is available with the CF. There are two other functions needed to be P/Invoked that are available under CE:
GetIconInfo
CreateIconIndirect
OK, anyone can explain how Jing take screen shots with that overlay form? It appears that it take a full screen shot and records all visible window handles and let you select within the form a specific hwnd. could be true? if is, what are the big steps to achieve this? could be a simple picturebox or without a custom control i don't have a chance to freeze the screen while taking a screen shot?
Thank you!
I'm not familiar enough with Jing to know exactly what it uses. But there are two basic techniques. One is as you mention, capture the screen and display it in a topmost borderless form. The Vista/Win7 Snipping tool works that way. You'll find the code you need to get this started it in my answer in this thread.
The other, perhaps more likely to be used by Jing, is similar to what Spy++ does, allowing the user to move the mouse and draw a selection rectangle around the window. Its advantage is that it can deal with windows resizing or disappearing while you've got the tool running. You implement it by using a topmost form the size of the screen that has its TransparencyKey property set to the value of the BackColor. Fuchsia is a popular choice. You can draw on this form with the OnPaint() method, the drawing appears on top of all the windows. You'd need some P/Invoke (GetWindow) to iterate the underlying windows in their Z-order to know which window the user is pointing at. GetWindowRect() to get the window rectangle. Plus some hassle to deal with Aero lying about the border size.
You can find sample code to get you started on that technique in my answer in this thread.
How to track the mouse position on the screen regardless of application.i.e. Whenever the user clicks or select something with mouse in any application, i want to display my own menu at that point itself.
Is there any way to get mouse position on the screen using c#?
To do this, you'd need to P/Invoke to user32.dll and use SetWindowsHookEx().
Have a look here:
SetWindowsHookEx (user32)
How to set a Windows hook in Visual C# .NET
That sounds like a bad idea. I'm sure you could force it with a bit of effort, but what about the other applications that may want to show their own menus when the mouse is clicked?
I have solved this issue, I used Low Level Mouse hooks and Low Level Keyboard hooks to implement the solution.
I am yet to add the Menu part of it.