GDI Canvas Ellipse でグリップ ポイントを描画できますが、2 番目のポイントが正しく描画されません。示された効果をどのように防止しますか?
procedure TFormMain.DrawMarchingAnts;
var
iWidth: integer;
begin
AMarchingAntsCounter := AMarchingAntsCounterStart;
// Use LineDDA to draw each of the 4 edges of the rectangle
LineDDA(AMarchingAntsPointA.X, AMarchingAntsPointA.Y, AMarchingAntsPointB.X, AMarchingAntsPointA.Y,
@MarchingAnts, LongInt(
AMarchingAntsCanvas));
LineDDA(AMarchingAntsPointB.X, AMarchingAntsPointA.Y, AMarchingAntsPointB.X, AMarchingAntsPointB.Y,
@MarchingAnts, LongInt(
AMarchingAntsCanvas));
LineDDA(AMarchingAntsPointB.X, AMarchingAntsPointB.Y, AMarchingAntsPointA.X, AMarchingAntsPointB.Y,
@MarchingAnts, LongInt(
AMarchingAntsCanvas));
LineDDA(AMarchingAntsPointA.X, AMarchingAntsPointB.Y, AMarchingAntsPointA.X, AMarchingAntsPointA.Y,
@MarchingAnts, LongInt(
AMarchingAntsCanvas));
if AMarchingAntsPointB.X > AMarchingAntsPointA.X then
ARubberbandVisible := True
else
ARubberbandVisible := False;
AMarchingAntsCanvas.Pen.Width := 1;
AMarchingAntsCanvas.Pen.Color := clWhite;
AMarchingAntsCanvas.Brush.Color := clRed;
AMarchingAntsCanvas.Ellipse(AMarchingAntsPointA.X-4, AMarchingAntsPointA.Y-4, AMarchingAntsPointA.X+4, AMarchingAntsPointA.Y+4);
iWidth := AMarchingAntsPointB.X - AMarchingAntsPointA.X;
AMarchingAntsCanvas.Ellipse(AMarchingAntsPointA.X-4 + iWidth, AMarchingAntsPointA.Y-4, AMarchingAntsPointA.X+4 + iWidth, AMarchingAntsPointA.Y+4);
end;