Well, I don't know about drawing the ellipse or streching and rotating, but I made this code recently to relocate an object. It's
not perfect (the object centre jumps to the mouse position), but it works.
Call this on the MouseMove event of your object:
Code:
if (MouseButtons == MouseButtons.Left)
{
mousePoint = /*Your Form/Groupbox Goes
Here*/.PointToClient(new Point(MousePosition.X - /*Your Control Goes
here*/.Size.Width / 2, MousePosition.Y - /*Your Control Goes
here*/.Size.Height / 2));
/*Your Control Goes here*/.Location = mousePoint;
}
You could fix the above mentioned 'jump to mouse' by recording two offset values on MouseDown, and adding them to the declaration of mousePoint, replacing the (yourControl.Size.Width / 2) and (yourControl.Size.Height /2).
On MouseDown ()
{
xOffset = MousePosition.X - /*Your Control Goes
here*/.Location.X;
yOffset = MousePosition.Y - /*Your Control Goes
here*/.Location.Y;
}
Hope this Helps
Bookmarks