Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:44:33+00:00 2026-06-16T04:44:33+00:00

I need to know how I could dynamically resize a label in a WPF

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:44:34+00:00Added an answer on June 16, 2026 at 4:44 am

    Changing the cursor is done via the this.Cursor property.

    I opened the code in the article and saw how they do it…

    In the OnMouseMove the cursor is changed if the left mouse button is NOT clicked:

    Point currentLocation = e.MouseDevice.GetPosition(wnd);
           ......
           ......
    const int dragHandleWidth = 3;
    
    var bottomHandle = new Rect(0, height - dragHandleWidth, width, dragHandleWidth);
    var rightHandle = new Rect(width - dragHandleWidth, 0, dragHandleWidth, height);
    
    Point relativeLocation = wnd.TranslatePoint(currentLocation, this);
    
    if (rightHandle.Contains(relativeLocation))
    {
        this.Cursor = Cursors.SizeWE;
    }
    else if (bottomHandle.Contains(relativeLocation))
    {
        this.Cursor = Cursors.SizeNS;
    }
    else
    {
        this.Cursor = Cursors.Hand;
    }
    

    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….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to know this so that i could send DTMF and that is going
One could think of this case as follows: The application dynamically loads a module,
Need to know which event triggered after text selection done in Apple iPad. It
I need to know which iOS device is currently running app (saying more exactly
For an application I am writing, I have the need to dynamically load content
I'd like to implement ASP.Net MVC application which could have controllers, views and content
I'm working on something which dynamically loads specially formulated DLL's. I need to be
I need a Java implementation of table-like data structure where I could dynamically insert
I know this question has been asked, how to make a site like facebook/gmail
I am developing a GPL-licensed application in Python and need to know if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.