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
Guan
NA
10
13.2k
Drawing a line between two points with Mouseclick
Aug 30 2010 4:19 PM
Hello everyone
I'm trying to make a very basic dwawing application where you can draw (eg. a line) on a panel.
The very basic code to draw a line on the panel by code is this:
private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Pen blackPen = new Pen(Color.Black, 4);
int X1 = 0, Y1 = 0, X2 = 250, Y2 = 100;
Graphics graphics = panel1.CreateGraphics();
e.Graphics.DrawLine(blackPen, X1, Y1, X2, Y2);
blackPen.Dispose();
}
Now is my question: how do i have to write the code so i can draw a line with 2 mouseclicks?
I think we could use point structures ? But how do i have to write everything ?
Reply
Answers (
4
)
Mouse background hook
recursion with StackOverflowException