Cursor change in Runtime - cursor

I am new to C# and WPF. I need to change the mouse cursor to a Rectangular type cursor in runtime.
The cursor should show when the custom cursor should show when mouse move out of the window. and it should change to mouse cursor when mouse moves into the window.
Any help is appreciated.

Related

How to simulate text selection by mouse in TextBox, but outside of TextBox control

Normally, in TextBox (WinForms) after hovering text by mouse cursor, keeping left button down and moving the mouse to the right or left, we can selected any text fragment (even if we move cursor take out of textbox area).
My question is how to simulate/trigger mouse text selection, but begining outside of TextBox control.
For example, let's say I have a TextBox with any text. Under this TextBox we place Panel control with this same Width and X location like textbox. Then, after left mouse button down on Panel area, it start highlighting of a piece of text in the TextBox (just like as if I did it directly over the TextBox).
So I assume that by clicking on the Panel area, special message should be sent to the TextBox, so that it starts selecting the text according to X cursor position (point Y is of course below the textbox).
Hope I was able to explain the question properly.

Hiding mouse cursor

I am using bgfx in c99 to experiment with game dev / game engine dev, so I need to hide my cursor using Windows.h / WinUser.h
However even if I use ShowCursor(false), SetCursor(NULL) the cursor will still appear on screen.
None of the solutions I tried worked. Any help ?
Thanks
According to SetCursor,
The cursor is a shared resource. A window should set the cursor shape
only when the cursor is in its client area or when the window is
capturing mouse input. In systems without a mouse, the window should
restore the previous cursor before the cursor leaves the client area
or before it relinquishes control to another window.
If your application must set the cursor while it is in a window, make
sure the class cursor for the specified window's class is set to NULL.(SetClassLong)
If the class cursor is not NULL, the system restores the class cursor
each time the mouse is moved.
ShowCursor sets an internal display counter that determines
whether the cursor should be displayed.(Application-Oriented,Tried) The cursor is displayed only
if the display count is greater than or equal to 0. If a mouse is
installed, the initial display count is 0. If no mouse is installed,
the display count is –1.

How do I hide the mouse cursor and set its position in gtk3?

I am trying to make a game where you move the mouse to change your view but you cannot see the mouse and the mouse needs to be stuck in the center, similar to in minecraft. In fact, this IS for my own personal knockoff of Minecraft. I need to hide cursor, and constantly setting the position of the cursor to the center. BUT I still need to track mouse movement, so I can change the view accordingly. These are my codes for how to find the center of the window.
int CenterY = gtk_widget_get_allocated_height(Window)/2;
int CenterX = gtk_widget_get_allocated_Width(Window)/2;
How shall I proceed?

Button change sized using Mouse

I would like to know if there is a way to resize a button Width using the mouse, like when you are in the design mode, I'd like to change the cursor to the resize cursor when the mouse pass over the edge of the button, and with a sutained click resize the button.
thanks !!
You should look into using Adorners for this. Here is an article on Code Project that describes how to "drag, resize and rotate elements on a Canvas", with and without Adorners: WPF Diagram Designer: Part 1

How to move WPF window above top of screen?

I have a window with the following:
Background="{x:Null}" AllowsTransparency="True" WindowStyle="None"
Dragging the window by hand beyond the left, right and bottom limits of the screen results in a predictably cropped window. However this behaviour is not the same for dragging it above the top limit. Instead of cropping, it pushes it back down as if there's an automatic If Window.Top < 0 Then Window.Top = 0.
This is probably in place so that users don't lose a Windows titlebar (which is the standard way to drag windows around, and losing sight of that effectively makes it undraggable). I don't need that as my entire window is draggable via Me.DragMove().
So, how do I let a window be dragged above the top limit of the screen?
(This is unrelated to Aero Snap which only occurs if the mouse touches the borders. I'm trying to move the window beyond visible bounds)
The DragMove function do not allow you to drag a window above the screen. You need to manually move the window, for example:
How do I move a wpf window into a negitive top value?

Resources