Increase Cursor Size on Entire Desktop - c#

First of all, please put aside notions of "Your application shouldn't do this". This is exactly what the people purchasing this software will be expecting.
How can I, system-wide, increase the size of the mouse cursor? I'd have to increase all mouse cursors too, so I don't think SetCursor would do the trick, at least not in any nice, clean way.
And I can't use the Form's Cursor Size as detailed here, as this would only affect the cursor when it's active on the form.
I see that there are "Extra Large" Mouse Cursors available in Windows' Ease-of-Access Centre, so there must be a way...
Any ideas?

Any solution to this is going to get really hairy because of two things:
1. Any application can change the cursor to anything else on its own
2. Cursors are at most 32x32 pixels
If an application changes the cursor to something that is 32x32 pixels, there's no way to make that any larger.
The Extra Large cursors are just just using more of the 32x32 pixels a cursor can use. The default ones are just using the top-left more-or-less quadrant of the 32x32.
You might be able to constantly Retrieve the current cursor using
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648388(v=vs.85).aspx
and then paint ontop of all windows that cursor doubled in size by stretching the image, then set the cursor to some empty cursor file. This is horribly hacky and will likely cause tons of flickering and compatibility problems.

Related

UI objects on same position for every resolution

There is a problem i created a button and text which is display correct on android resolution but when i change the resolution to free aspect it change the position of button and text like this
I tick the button component Image (Script) preserve aspect and changing the anchors of both object like this
but nothing happen i want to display these two on same position where it is when changing any resolution.
First of all, do not use Free Aspect to test different resolutions. Free aspect isn't really a resolution and often you can see bugs that you will not ever see on real devices.
For your problem anyway you have what's called Anchors in each UI element. An anchor defines where you want to "attach" your UI element and especially to what element or corner of the screen you want to attach it. For your example, on the Rect Transform, click on the square drawing (representing the anchors) and choose Bottom Left.
Your element will be moved, you can move it where you want to and it will always be attached to the bottom left corner of your screen:
If you want to know more about UI for multiple resolutions, you can go here: http://docs.unity3d.com/Manual/HOWTO-UIMultiResolution.html
Good luck!

Keep form and controls proportion deployng a c# application for any screen size

I know this is an "already heard" problem: I have searched a lot but I did not find anything that cleared my mind.
I am developing a c# application with a GUI containing some controls like buttons (made with images) and text.
I developed it setting the main form size to 800x600 but now I need the application to work also on a 1920x1080 screen.
Two problems:
If I position a button near the top-right corner of the main form and set AnchorStyles to Top-Right, when I switch to the big screen, the button is (in proportion) much more close to top-left corner than in the little screen (because the anchor keeps the distance from the border). Is there a way to set a proportional distance from the border?
How can I scale the dimensions of the controls proportionally to the screen size? Shall I use AutoScaleMode like suggested here?
There is a way to add a capability to a form at design time - the ToolTip control does it, that makes properties available to every control on a form. These are called "Extender Providers"
http://msdn.microsoft.com/en-us/library/ms171836
You would want to look at the controls, and cache their sizes and fonts at design time, and the size of the form.
The provider would hang off the form.SizeChanged event at run time. When the size changes, you use the new and original (design time) sizes of the form to calculate and X and Y ratio. You then go through each control and use it's design time size and the ratios to determine its new size and font size. This can get flaky if you allow the user to select sizes that are not the same aspect ratio as your original.
Anyway, that is how it was done in Delphi, and everyone knows if you can do it in Delphi, you can do it in C# :)

Set the cursor to go to the other border of the screen if it goes into one in WPF

I'm currently developing a 3D viewer application in WPF, and for ergonomy reasons I want my mouse to go to the other border of the screen if it goes into one.
For example, if my mouse goes into the top screen border, set I set my mouse position to the bottom of my screen.
Same for left/right.
How can I actually detect my mouse position in WPF? The only position I can get is related to the software and not the entire screen.
Also, it would be great if it could support dual monitors. (So the mouse is re-set only if it goes into the second monitor)
based on the informative answers to the s.o. question here:
How do I get the current mouse screen coordinates in WPF?
I think the simpler way to go is the windows.forms method, unless your 3d graphics are updating a lot of computation and you don't want the extra .net unboxed loop performance margin hit. According to this msdn reference:
http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx
the Cursor.Position property is settable, so should be settable from WPF app, although you want to do some research and testing before committing to a lot of code on that

auto-scaling size with anchors - overlapping controls

I'm having some trouble with resizing and scaling of controls in a windows form. I've set anchors up so that the controls stay in ratio with the form, which works great. However, perhaps i was expecting too much when i thought that the control origin points would also scale and change with the form scaling, but this is not the case and i'm finding my controls overlapping. here's some screenshots;
anyone know of an approach i can take to solve this problem? perhaps i need to set control origins to dynamic drawing points that scale, but then do these redraw on scaling the form, or only on creation?
edit 1: just found this question hidden amongst the internet, Problem: Anchored controls are overlapping perhaps i need to implement something like this, a resize event.
The preferred solution should be the TableLayoutPanel. Handling OnResize is going to be much more fragile.
I wonder if Anchor is really about scaling, it basically anchors the sides of a control to the container and scaling is a by product of this. For eg. if both left & right sides are anchored the control will scale in width because anchor will try to keep the location of left & right sides intact.
keeping that in mind you have to think what do you want when the form is increased in size and you have more space. In the case above you might want the list box lbLog to say remain same size but the panel Simulate take up any sapce created. For such a scenario you would anchor the panel on both left & Right side while you will anchor the list box only the right.
Basically if you want all your controls to proportionally scale (true scaling I would say as opposed to scaling in case of anchoring) then Anchoring is not the right solution.

Changing Resolution in OpenTK

I've been searching around for this, I've managed to find out out to change the size of our window, and how to change the resolution of the monitor.
But I can't seem to find how to tell OpenGL where and how big my viewport is.
Example: the game starts up in 400x300, and I expand the window to 800x600. I now have a 800x600 window, but only a 400x300 box in the corner is being rendered to.
I get the same problem when switching to fullscreen, the gray area covers the entire screen, but I only have a small box in the corner being rendered to.
Any OpenTK people out there that know how to do this?
You need to refresh your viewport:
GL.Viewport(gameWindow.ClientRectangle);

Categories