I need to know how I could dynamically resize a label in a WPF application.
I’ve already found a sample in this article which has already achieved both dragging and resizing a label at the same time.
I dug into the code, and to make it short, I found out that inside OnMouseMove event of the label, it checks the mouse cursor shape and if it was Hand it will do the dragging and if it was either of the resizing arrows it will do the resizing correspondingly.
Check it out. you’ll see.
In this certain example I couldn’t manage to find out how the cursor shape changes to resizing arrows when the mouse is hovered on the label’s border.
So
I either need to find out ‘how I could change the mouse cursor shape to resizing arrows when hovered on a label’s border’, OR to find a new approach to resize a label, dynamically.
Changing the cursor is done via the
this.Cursorproperty.I opened the code in the article and saw how they do it…
In the
OnMouseMovethe cursor is changed if the left mouse button is NOT clicked:In other words, they check if the current mouse location is within 3 px of the bottom or right border, if it is, they change the cursor accordingly…
You can easily change this logic to suite your needs….