Tuesday, May 12, 2009

Handle Click Event of Eclipse: Windows Application

Normally we dont have any event for the Drawing objects like circle, eclipse ect., so here I am trying to draw a eclipse using graphics and try to give clicking effect and handing that event.

Declare the event handler and deligate to handle the events

image

Initialise the Click Event for eclipse we are drawing in Form_Load

image

Draw eclipse in Form paint method

image

To give clicking effect we need to draw a similar eclipse when you 
press the mouse, also check the bounds where mouse is being clicked, please add following code in Form1_MouseDown

image

And add following code in Form1_MouseUp

image

Following event will be called when you click the eclipse, so please add following code block

image

Now we are ready our code just build, run and test.

Tags: Drawing in C#, Eclipse, Handling Events

No comments:

Post a Comment