Re: Size from two Point variables
- From: Samuel R. Neff <samuelneff@xxxxxxxxxx>
- Date: Thu, 15 Feb 2007 12:39:36 -0500
You can convert the points to sizes and then use Size subtraction, but
have to deal with issues like did they drag from top/left to
bottom/right or reverse.
I think easiest is to just perform math separately and then create a
size structure from that:
height = Math.Abs(mousedownPoint.X - mouseupPoint.X);
width = Math.Abs(mousedownPoint.Y - mouseupPoint.Y);
Size sz = new Size(width, height);
Unless you want the sizes to be negative which is possible depending
on what you're going to do with the data...
HTH,
Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Thu, 15 Feb 2007 12:20:21 -0500, "Dan Reber" <dreber@xxxxxxxxxx>
wrote:
I have to Point variables that are being set on MouseDown and MouseUp
events --
mousedownPoint = new Point(e.X, e.Y);
mouseupPoint = new Point(e.X, e.Y);
Is there a way that I can take those two points and get a Height and Width
value from it to use for a Size variable? I have tried many different ways
but none of them have worked.
Thanks
Dan
.
- Follow-Ups:
- Re: Size from two Point variables
- From: Dan Reber
- Re: Size from two Point variables
- References:
- Size from two Point variables
- From: Dan Reber
- Size from two Point variables
- Prev by Date: Re: Progress bar!
- Next by Date: Re: array size. out of memory exception.
- Previous by thread: Size from two Point variables
- Next by thread: Re: Size from two Point variables
- Index(es):
Relevant Pages
|