TDrawingTool = (dtLine, dtRectangle, dtEllipse, dtRoundRect);var Drawing: Boolean; Origin, MovePt: TPoint; DrawingTool: TDrawingTool;procedure TMain_frm.LandMapMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin Drawing := True; LandMap.Canvas.Pen.Width := 1; LandMap.Canvas.Pen.Style := psDot; LandMap.Canvas.MoveTo(X, Y); Origin := Point(x, y); MovePt := Origin;end;procedure TMain_frm.LandMapMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin StatusBar1.Panels[1].Text := Format('Current: (%d, %d)', [X, Y]); if Drawing then begin DrawShape(Origin, MovePt, pmNotXor); MovePt := Point(X, Y); DrawShape(Origin, MovePt, pmNotXor); end;end;procedure TMain_frm.LandMapMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);beginif Drawing then begin SButton_Down; TreeLoadImage; //取消地图选择时的虚线 Drawing := False; end;end;