Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem Jak v listview schovat hor scrollbar (Delphi)

Zdravím.
Poradi někdo jak v komponentě listview schovat horizontalní scrollbar.
Mam XE2.
Na netu je toho spousta ale nic nefunguje.
Zkoušel jsem třeba dat do FormCreate

SetWindowLong(ListView1.Handle, GWL_STYLE, GetWindowLong(ListView1.Handle, GWL_STYLE) and not WS_HSCROLL);

Ale furt tam mrška je :-D

Předmět Autor Datum
Title: hide the horizontal/vertical scrollbar in a TListView? type TForm1 = class(TForm) ListView1:… poslední
pme 11.12.2012 18:11
pme

Title: hide the horizontal/vertical scrollbar in a TListView?

type
  TForm1 = class(TForm)
    ListView1: TListView;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    FListViewWndProc: TWndMethod;
    procedure ListViewWndProc(var Msg: TMessage);
  public
   { Private declarations }
    FShowHoriz: Boolean;
    FShowVert: Boolean;
  end;
  
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ListViewWndProc(var Msg: TMessage);
begin
  ShowScrollBar(ListView1.Handle, SB_HORZ, FShowHoriz);
  ShowScrollBar(ListView1.Handle, SB_VERT, FShowVert);
  FListViewWndProc(Msg); // process message
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FShowHoriz := True; // show the horiz scrollbar
  FShowVert := False; // hide vert scrollbar
  FListViewWndProc := ListView1.WindowProc; // save old window proc
  ListView1.WindowProc := ListViewWndProc; // subclass
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  ListView1.WindowProc := FListViewWndProc; // restore window proc
  FListViewWndProc := nil;
end;

Netestoval som... ;-)

Zpět do poradny Odpovědět na původní otázku Nahoru