Re: Drawing graphics and responding to events
Peter Osucha <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
ahhhhh, it seems that using the GraphicsPath class and the Graphics.DrawPath() method to draw the circles will then allow me to check the IsVisible() and IsOutlineVisible() properties in the MouseMove() event. Seems like a better way to do this. Any other ways? Peter -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls on behalf of Peter Osucha Sent: Tue 4/24/2007 9:46 PM To: [email protected] Subject: [DOTNET-WINFORMS] Drawing graphics and responding to events I'm looking for 'better' ways to handle/track mouse events for the following... I have a panel on which I have drawn a 20x20 array of small circles using Graphics.DrawEllipse(). For each of the circles, I created an object (myCircle) that holds information about the circles location within the panel (the rectangle it is within and the actual circle center and radius). I am then handling the MouseMove event of the panel to effect a 'hover' type action (ie, I just change the color of the circle if the mouse moves over it). To do this, I get the mouse coordinates inside the panel and then loop through all the myCircle objects looking for a coordinate match. If one is found, then I change the color of the circle, etc. Although this works, it certainly doesn't seem that efficient. Can anyone suggest another direction I might want to try to create this behavior? Other actions will be added as I move forward - like the ability to change the color of a many circles by 'dragging' a box around them etc. It just seems that this 'loop over all myCircle objects checking for coordinate matches' isn't the best approach. Sincerely, Peter