Re: Size from two Point variables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




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


.



Relevant Pages

  • Re: Size from two Point variables
    ... have to deal with issues like did they drag from top/left to ... bottom/right or reverse. ... Unless you want the sizes to be negative which is possible depending ... Developers for exciting positions in medical product ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: HTTP 404 error on pages
    ... What type of files and what sizes ... In Remote Web Site view select them and drag across ... If on a case sensitive server check the case ...
    (microsoft.public.frontpage.client)
  • Re: Icon Collection
    ... Its pretty massive and have all sorts of sizes for each icon. ... blogs.myc4d.com - Your access to code tidbits and comments ... Application server enabling technology for developers ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Size & Position of open windows/programs
    ... ~Robear Dyer ... Jim wrote: ... the sizes of the windows vary. ... I size everything and drag to where I want on my screen but then when I open them again they have changed size and position. ...
    (microsoft.public.windowsxp.general)
  • Re: Reducing a digital jpeg photo to smaller size suitable for the web
    ... large digital photos and reducing them to smaller sizes for use on web pages. ... may be of interest to the developers). ...
    (comp.graphics.apps.gimp)