Click to See Complete Forum and Search --> : Identify drawn area and display in tool tip.


dileepmn
August 17th, 2005, 03:30 AM
Hai friends,

Suppose I drawn 3 circle in client area using GDI functions. I wan to display Circle1, CIrcle2 and CIrcle3 when user pointing into the corresponding circle area.I don't think it is easy with GDI functions.Pls tell me the the way I want to follow.

In flash it is easy because each Circle(each drawing) can be done in seperate movie clip.Since movie clip is an object we can attach mouse move event easily.But I don't know how it can be done in VC++.

Hope you will respond soon.

philkr
August 17th, 2005, 09:17 AM
Since you have drawn the circle yourself, you know it's center coordinate and radius. You can use GetCursorPos() to get the mouse coordinates and then put that x and y variables in the circle equation. This translates into the following if-condition:

if((MousePos.x - CenterX)*(MousePos.x - CenterX) + (MousePos.y - CenterY)*(MousePos.y - CenterY) <= Radius * Radius)
{
// The mouse is in the circle
}

EDIT: Corrected the comparitive operator. Note the meaning:

'<=' means mouse is in the circle
'==' means mouse is on the circle
' > ' means mouse is outside the circle

dileepmn
August 22nd, 2005, 02:49 AM
Hai Philkr,

Now it is great. Thanks for your valid help.Do you know how to trace polygon.

Thanks
Dileep.M.N