TMemoでスクロールバーを縦横別々にON/OFFする
80 MemoScrollBarONOFF 動作確認 Delphi2007 更新日 2008/02/04(月)

縦と横のスクロールバーは
TMemoなどではTScrollStyleプロパティで設定します。

  TScrollStyle = (ssNone, ssHorizontal, ssVertical, ssBoth);

と宣言されています。
これを縦スクロールバーだけON/OFF
横スクロールバーだけON/OFFしたい場合は
次のような関数を使ってください。

使い方も乗せました。
────────────────────
function ScrollBarVertical(Source: TScrollStyle; Enabled: Boolean): TScrollStyle;
begin
  if Enabled then
  begin
    Result := Source;
    case Source of
      ssNone:       Result := ssVertical;
      ssHorizontal: Result := ssBoth;
    end;
  end else
  begin
    Result := Source;
    case Source of
      ssVertical:   Result := ssNone;
      ssBoth:       Result := ssHorizontal;
    end;
  end;
end;

function ScrollBarHorizontal(Source: TScrollStyle; Enabled: Boolean): TScrollStyle;
begin
  if Enabled then
  begin
    Result := Source;
    case Source of
      ssNone:       Result := ssHorizontal;
      ssVertical:   Result := ssBoth;
    end;
  end else
  begin
    Result := Source;
    case Source of
      ssHorizontal: Result := ssNone;
      ssBoth:       Result := ssVertical;
    end;
  end;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  //縦スクロールバーをON/OFFする
  Memo1.ScrollBars :=
    ScrollBarVertical(Memo1.ScrollBars, CheckBox1.Checked);
end;

procedure TForm1.CheckBox2Click(Sender: TObject);
begin
  //横スクロールバーをON/OFFする
  Memo1.ScrollBars :=
    ScrollBarHorizontal(Memo1.ScrollBars, CheckBox2.Checked);
end;
────────────────────