StringGrid的Options的goRowSelect為false時,在點擊右側未顯示完全的Cell,StringGrid會自動向左滾動,怎樣設定,取消StringGrid的自動滾動啊?Delphi7版的
終於自己找到解決辦法了:
拷貝Grids.pas到自己項目的目錄,
修改
procedure TCustomGrid.MoveCurrent(ACol, ARow: Longint; MoveAnchor,
Show: Boolean);
var
OldSel: TGridRect;
OldCurrent: TGridCoord;
begin
if (ACol < 0) or (ARow < 0) or (ACol >= ColCount) or (ARow >= RowCount) then
InvalidOp(SIndexOutOfRange);
if SelectCell(ACol, ARow) then
begin
OldSel := Selection;
OldCurrent := FCurrent;
FCurrent.X := ACol;
FCurrent.Y := ARow;
if not (goAlwaysShowEditor in Options) then HideEditor;
if MoveAnchor or not (goRangeSelect in Options) then
begin
FAnchor := FCurrent;
if goRowSelect in Options then FAnchor.X := ColCount - 1;
end;
if goRowSelect in Options then FCurrent.X := FixedCols;
// if Show then ClampInView(FCurrent); {-20161029 將這一行注釋掉}
SelectionMoved(OldSel);
with OldCurrent do InvalidateCell(X, Y);
with FCurrent do InvalidateCell(ACol, ARow);
end;
end;