TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Casper Hansen
NA
14
0
Dragable rectangles
Jul 14 2008 3:23 PM
Hello.
I have a question..
I have this script:
int mouseDownX;
int mouseDownY;
int width;
int height;
private void Form1_MouseUp(object sender, MouseEventArgs mouseEv)
{
width = mouseEv.X - mouseDownX;
height = mouseEv.Y - mouseDownY;
textBox2.Text = Convert.ToString(mouseEv.Location);
Graphics graphics = this.CreateGraphics();
Rectangle rectangle = new Rectangle(
mouseDownX, mouseDownY, width, height);
graphics.DrawRectangle(Pens.Red, rectangle);
}
private void Form1_MouseDown(object sender, MouseEventArgs mouseEv)
{
textBox1.Text = Convert.ToString(mouseEv.Location);
mouseDownX = mouseEv.X;
mouseDownY = mouseEv.Y;
}
Which works fine if I make a rectangle from the left top corner to the right bottom corner
But is there any easier way of just making rectangles?
Here is a video of what I want:
http://www.youtube.com/watch?v=V5YO4U1UnO0
And here is a download link to my project:
http://peecee.dk/upload/download/123329
So I want to be able to draw rectangles from any angle if you understand?
Reply
Answers (
1
)
removing a decimal point "." from a string.
I need help exporting data from a grid