X
xifengge
Unregistered / Unconfirmed
GUEST, unregistred user!
我想利用BeginPath 和 EndPath 记录鼠标轨迹,在MouseUp事件时将画的线封闭并填充,这两个API用在一个过程里倒是可以的,但是下面这样写为什么就不能填充啊?<br><br>procedure TForm6.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> Canvas.Pen.Color := clGreen;<br> Canvas.Brush.Color := clRed;<br> BeginPath(Canvas.Handle);<br> Canvas.MoveTo(X ,Y);<br>end;<br><br>procedure TForm6.FormMouseMove(Sender: TObject; Shift: TShiftState; X,<br> Y: Integer);<br>begin<br> Canvas.LineTo(X, Y);<br>end;<br><br>procedure TForm6.FormMouseUp(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> CloseFigure(Canvas.Handle);<br> EndPath(Canvas.Handle);<br> StrokeAndFillPath(Canvas.Handle);<br>end;