Click here to Skip to main content
15,900,108 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I know must of the code it is

textBlock2.Margin = new Thickness(0, 0, 0, 0);


I know in a none WPF the code is

this.location = new point (0,0);


I want it to be at the cursors location when its pressed like this

this.location = new point(e.location.X,e.location.Y);


So yeh

textBlock2.Margin = new Thickness(e, e, 0, 0);


Can some one please help me out .

Thanks in Advance.
Posted
Updated 20-May-11 21:34pm
v2

1 solution

I am not sure I follow, but I think perhaps you want 0, 0, e.location.X, e.location.Y, so that the margin is the width and heigh of the mouse position. The control also has methods if you need to convert your point to be relative to the top left of the window, instead of the screen ( and I think you do ). Point p = e.GetPosition(this); is the code I would expect you to use, where e is the mousebuttonevent args. Then p is the point you use in your Thickness constructor.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900