Last post Jan 14, 2007 08:29 PM by miztiik
Jan 11, 2007 06:36 PM|miztiik|LINK
There is an image on the webform.i want to find out the co ordinates[which is going to tbe the end points of the diagonal of a rectangle, which will be drawn subsequently ] of the point where the user clicked on the image.
Jan 11, 2007 06:42 PM|RTernier|LINK
Use the ImageClickEventArgs.
e.X and e.Y that will tell you where it was clicked.
Jan 11, 2007 06:56 PM|Jigar|LINK
You asked very similar question on this thread.
and it has answer and sample code also.
Jan 11, 2007 07:03 PM|miztiik|LINK
Jan 11, 2007 07:38 PM|Jigar|LINK
Store point that user clicked first in viewstate or any other place you want
Let user click on another point
Graphics.DrawrRectangle method to draw rectangle
Jan 11, 2007 07:49 PM|miztiik|LINK
Jan 11, 2007 07:56 PM|RTernier|LINK
That's up to you.
You could also use AJAX to draw the image ontop of the image... or stretch a <div> with alpha transperancy set over the image so it seems like it's doing it dynamically.
Jan 11, 2007 08:12 PM|miztiik|LINK
Stretchng the <DIV> with alpha tranperancy seems to be the easiest solution,
Any code samples please
Jan 11, 2007 08:20 PM|RTernier|LINK
I have no code files as I've never done it - but theoretically it's simple to do.
You know where the XY cordinates of the image when clicked. When the user clicks again you'll know 2 sets of XY chors. From there you set the position of the div (over that image) using those cords. and the image cordinates. When you change the size of
the div it will just sit on top of the image (Watch the Z Value).
Use opacity and transparency on the div.
Jan 11, 2007 08:36 PM|miztiik|LINK
Well i intend to have it like this [Pretty much like the Click-and-Drag Select, that we do on our desktops]
Once the user selects the first point on the image, we have one X,Y Coordinate, keeping that as the reference top left coordinate of the rectangle and the mouse pointer end for the bottom right coordinate of the rectangle..i would like to have an elastic
rectangle until the user picks up a second point on the image.
Hope i am clear
Jan 12, 2007 01:56 AM|RTernier|LINK
Jan 14, 2007 02:15 PM|ibrahimersoy|LINK
are u going to draw geometric shapes using coords? or something else?
Jan 14, 2007 08:29 PM|miztiik|LINK
I am not planning to draw a variety of shapes, all i would like to have is two co ordinates for the end points of a rectangle. and both these co ordinates are liked to be picked up by the user user by clicking on the canvas image