Hide vertical scrollbar of a listbox?

How can I hide the vertical scrollbar of a listbox and a checkboxlist and scroll them from code?

Thank you for your help,
Levente
LeventeAsked:
Who is Participating?
 
kretzschmarConnect With a Mentor Commented:
hi levente,

so it goes

unit lb_nosb_u;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

//Hide Scrollbars
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowScrollBar(ListBox1.Handle,SB_BOTH,False);
end;

//Scrool Up
procedure TForm1.Button2Click(Sender: TObject);
begin
  if Listbox1.TopIndex > 0 then
    Listbox1.TopIndex := Listbox1.TopIndex - 1;
end;

//Scroll Down
procedure TForm1.Button3Click(Sender: TObject);
begin
  if Listbox1.TopIndex < ListBox1.Items.Count - 1 then
    Listbox1.TopIndex := Listbox1.TopIndex + 1;
end;

end.

meikl
0
 
intheCommented:
nice unit name :-)
0
 
kretzschmarCommented:
;-)
lb_nosb_u
means
ListBox_NoScrollBars_Unit
;-)

0
All Courses

From novice to tech pro — start learning today.