Jason
Jason

Reputation: 694

Adding Event listener to drawn objects

At the moment I am drawing rectangles using Windows Forms.

g.DrawRectangle(new Pen(Color.Black),new Rectangle(new Point(10,10),new Size(50,50)));

But I would like to add Event Listener to this so that I can make them moveable and resizeable.

Can I do this using Windows Form DrawRectangle() or is there a different way?

Upvotes: 3

Views: 383

Answers (1)

ispiro
ispiro

Reputation: 27713

You can use Panel's instead.

If you want them movable and resizeable - use Form's. (See this answer.)

(As for events for drawn objects like in your example - I don't know of a simple way to do that. But you can try calculating where the mouse clicked on the Form...)

Upvotes: 1

Related Questions