1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117:
| procedure TFMain.PicMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var DrawX, DrawY, i: integer; tmp: string; begin if Mausaktiv = True then begin Pic.Canvas.Brush.Color:= clWhite; Pic.Canvas.FillRect(Rect(MausX,MausY, OldX, OldY));
if checkmove(tLeft, tTop, tRight, tBottom) = True then begin if (X > Pic.Width) then begin DrawX:= Pic.Width; end else if (X < 0) then begin DrawX:= 0; end else begin DrawX:= X; end; if (Y > Pic.Height) then begin DrawY:= Pic.Height; end else if (Y < 0) then begin DrawY:= 0; end else begin DrawY:= Y; end; end;
if MausX > DrawX then begin tLeft:= DrawX; tRight:= MausX; end else begin tLeft:= MausX; tRight:= DrawX; end; if MausY > DrawY then begin tTop:= DrawY; tBottom:= MausY; end else begin tTop:= MausY; tBottom:= DrawY; end;
Pic.Canvas.Brush.Color:= $00BAF8C8; Pic.Canvas.Rectangle(Rect(tLeft, tTop, tRight, tBottom));
Oldx:= DrawX; OldY:= DrawY; end; end;
function TFMain.Checkmove(left2, top2, right2, bottom2 : integer): boolean; var i: integer; tmp: string; left3, top3, right3, bottom3: integer; ok: boolean; begin ok:= True; for i:= 0 to Tables.Count - 1 do begin tmp:= Tables.Strings[i]; left3:= StrToInt(Copy(tmp, 0, Pos('.', tmp) - 1));
tmp:= Copy(tmp, Pos('.', tmp) + 1, Length(tmp)); top3:= StrToInt(Copy(tmp, 0, Pos('.', tmp) - 1));
tmp:= Copy(tmp, Pos('.', tmp) + 1, Length(tmp)); right3:= StrToInt(Copy(tmp, 0, Pos('.', tmp) - 1));
tmp:= Copy(tmp, Pos('.', tmp) + 1, Length(tmp)); bottom3:= StrToInt(tmp);
if ((right2 >= left3) and (left2 <= right3) and (top2 >= top3) and (top2 <= bottom3)) then begin ok := False; end; end;
if ok = False then begin Result:= False; end else begin Result:= True; end; end; |