资 源 简 介
本源代码主要演示Delphi7利用鼠标绘制矩形焦点,画出虚线框矩形,按住鼠标左键抖动矩形区域,即可显示虚线矩形框,可应用于需要拖动选择对象时作为选区使用,在Delphi中,这个功能使用Canvas实现:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if IsDraw then
begin
if Count >1 then
DrawFocusRect(Canvas.Handle,FocuRect);
FocuRect.Right := X;
FocuRect.Bottom := Y;
DrawFocusRect(Canvas.Handle,FocuRect);
Inc(Count);
IsEndDraw := True;
end;
end;