Please help me to know how to do this.
1:I know how draw a shape on a form.
2:And I can let user click on the form and check if user
has clicked near the shape or not.
3:And also know how make the shape looks larger,changing
Graphics.TransForm value.
4:But,after that,I can't check if user do mouse clicking
near the shape or not.
Following 2 classes are code example of (1,2) and (3,4)
respectively.
Please teach me how to check ....
(Pls. don't mind any wrong grammer use in my example.)
class noZoomForm:Form{
Point pt1=Point(10,10);
Point pt2=Point(100,100);
Graphics g;
private void MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if(points_are_close_enouph(pt1,new Point(e.X,e.Y));
{g.DrawLine(pt1,pt2,/*in red*/);}
}
void Load()
{
g=this.CreateGraphics();
g.DrawLine(pt1,pt2,/*in black*/);
//after loading,mousedowning near pt1 make line white.
}
}
class ZoomForm:noZoomForm
{
void Load()
{
g=this.CreateGraphics();
g.TransForm=new Matrix(unitRect,doubledAndMovedRect);
g.DrawLine(pt1,pt2,/*in black*/);
//after loading,mousedowning near pt1 dosen't make line
white.
}
}