小
小树流
Unregistered / Unconfirmed
GUEST, unregistred user!
如题
procedure TEditFrame.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited;
RectP1.x := X;
RectP1.y := Y;
RectP2 := RectP1;
Canvas.Pen.Mode := pmNotXor;
Canvas.pen.Style := psDot;
Canvas.Pen.Color := clBlack;
Canvas.Brush.style := bsClear;
end;
procedure TEditFrame.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
inherited;
if ssLeft in Shift then
begin
Canvas.Rectangle(RectP1.x, RectP1.y, RectP2.x, RectP2.y);
Canvas.Rectangle(RectP1.x, RectP1.y, X, Y);
RectP2.x := X;
RectP2.y := Y;
end;
end;
procedure TEditFrame.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited;
Canvas.Rectangle(RectP1.x, RectP1.y, RectP2.x, RectP2.y);
end;
总是会影响背景,有什么方法可以不影响呢?
我不想用drawfocusrect
procedure TEditFrame.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited;
RectP1.x := X;
RectP1.y := Y;
RectP2 := RectP1;
Canvas.Pen.Mode := pmNotXor;
Canvas.pen.Style := psDot;
Canvas.Pen.Color := clBlack;
Canvas.Brush.style := bsClear;
end;
procedure TEditFrame.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
inherited;
if ssLeft in Shift then
begin
Canvas.Rectangle(RectP1.x, RectP1.y, RectP2.x, RectP2.y);
Canvas.Rectangle(RectP1.x, RectP1.y, X, Y);
RectP2.x := X;
RectP2.y := Y;
end;
end;
procedure TEditFrame.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited;
Canvas.Rectangle(RectP1.x, RectP1.y, RectP2.x, RectP2.y);
end;
总是会影响背景,有什么方法可以不影响呢?
我不想用drawfocusrect