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

  • SEARCH
  • Home
  • 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 6539481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:51:51+00:00 2026-05-25T10:51:51+00:00

How do I go about implementing the drag delta on a Shape, I have

  • 0

How do I go about implementing the drag delta on a Shape, I have the following code:

void Connector_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
        if (e.ClickCount == 1)
        {
            this.Focus();
            this.CaptureMouse();
            this.RaiseEvent(new DragStartedEventArgs(0,0));
            initMousePoint = e.GetPosition(this);
        }
        e.Handled = true;
    }
    void Shape2_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
    {
        currMousePoint = e.GetPosition(this);
        if (this.IsMouseCaptured)
        {
                this.RaiseEvent(new DragDeltaEventArgs(0,0);
        }
    }
    void Shape2_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
        this.ReleaseMouseCapture();
    }

Now for the DragDeltaEvent args do I need to compute the drag in the mousemove and pass it to the event, also is this the right way to raise the event. If this works, then I should only subscribe to the drag delta event and use it as a thumb? Note, I do not want to template the thumb with the shape, providing this answer won’t help me.


note the chagnes, about the getting the position of the mouse, this I don’t think works, because it gets the position relative to the element, not the containing panel, so I don’t think i will be able to find the drag distance this way.

  • 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-05-25T10:51:52+00:00Added an answer on May 25, 2026 at 10:51 am

    I solved it using:

    currMousePoint = e.GetPosition(this);
    double dragHorizontal = currMousePoint.X - initMousePoint.X;
    double dragVertical = currMousePoint.Y - initMousePoint.Y;
    //Set the new canvas top and left proeprties here.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Do anyone have an idea about implementing the following behaviour using the Input mask
Have you any idea about implementing 2D object recognition with MATLAB? Which characteristics of
I have been following the Railscast #270 found Rails Cast #270 about implementing Authentication
My knowledge about implementing a parser is a bit rusty. I have no idea
Where can I get info about implementing my own methods that have the ellipsis
How would I go about implementing an inventory system for a game in PHP?
In implementing M-V-VM in a project and following advice of Karl Shifflett about implementing
My manager has recently asked my team and I for our input about implementing
How would I go about implementing a feedback function on a windows phone 7
How does one go about implementing a subtype of Numeric[T]? I have been looking

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.