Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.12.16;
Скачать: CL | DM;

Вниз

прокрутка ListView   Найти похожие ветки 

 
Илья_С   (2007-09-23 16:52) [0]

Уважаемые мастера.
Как из ListView насовсем убрать горизонтальную прокрутку?
Спасибо.


 
Lacmus ©   (2007-09-23 19:02) [1]



unit Unit72;

interface

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

type
 TListViewEx = class(TListView)
   procedure WMNCPaint(var aMessage: TMessage); message WM_NCPAINT;
 end;

 TListView = class(TListViewEx);

 TForm72 = class(TForm)
   ListView1: TListView;
   Button1: TButton;
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form72: TForm72;

implementation

{$R *.dfm}

procedure TForm72.Button1Click(Sender: TObject);
var
 i: Integer;
begin
 ListView1.ViewStyle := vsReport;

 ListView1.Items.BeginUpdate;
 try
   for i := 0 to 100 do
     ListView1.Items.Add.Caption := "Item" + IntToStr(i);
 finally
   ListView1.Items.EndUpdate
 end
end;

procedure TListViewEx.WMNCPaint(var aMessage: TMessage);
begin
 if (GetWindowLong(Handle, GWL_STYLE) and WS_HSCROLL) <> 0 then begin
   ShowScrollBar(Handle, SB_HORZ, False);
   SetScrollRange(Handle, SB_HORZ, 0, 0, True);
 end;
 inherited;
end;

end.


 
Leonid Troyanovsky ©   (2007-09-24 09:10) [2]


> Илья_С   (23.09.07 16:52)  

> Как из ListView насовсем убрать горизонтальную прокрутку?

By Peter Below

type
 TNoHScrollListview = Class( TListview )
 private
   Procedure WMNCCalcSize( Var msg: TMessage ); message WM_NCCALCSIZE;
 end;

procedure TNoHScrollListview.WMNCCalcSize(var msg: TMessage);
var
 style: Integer;
begin
 style := getWindowLong( handle, GWL_STYLE );
 If (style and WS_HSCROLL) <> 0 Then
   SetWindowLong( handle, GWL_STYLE, style and not WS_HSCROLL );
 inherited;
end;


--
Regards, LVT.


 
Lacmus ©   (2007-09-24 11:59) [3]

>Leonid Troyanovsky ©   (24.09.07 09:10) [2]

После добавления элементов в ListView часть нижней рамки другого цвета,
при изменении ширины какого либо столбца меняется ширина этой области.
Лечится SetScrollRange(Handle, SB_HORZ, 0, 0, True), возможно есть другое решение данной проблемы.

Часть моего DFM-файла



 object ListView1: TListView
   Left = 48
   Top = 32
   Width = 353
   Height = 305
   Columns = <
     item
       Caption = "123"
       Width = 200
     end
     item
     end
     item
     end
     item
     end
     item
     end>
   IconOptions.AutoArrange = True
   TabOrder = 0
   ViewStyle = vsReport
 end


 
Leonid Troyanovsky ©   (2007-09-24 14:15) [4]


> Lacmus ©   (24.09.07 11:59) [3]

> После добавления элементов в ListView часть нижней рамки
> другого цвета,

На моем 2003 server (темы не используются)
эффект не проявляется.

--
Regards, LVT.


 
Lacmus ©   (2007-09-24 19:30) [5]

Вообщем то и стиль WS_HSCROLL присутствует, хотя видимой полосы прокрутки нет, наверно какие то особенности XP.



Страницы: 1 вся ветка

Текущий архив: 2007.12.16;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.023 c
2-1195201850
timekiller
2007-11-16 11:30
2007.12.16
Delphi, XML, parent Node


2-1195235118
art36
2007-11-16 20:45
2007.12.16
Создать теги, метки программно возможно, но.....


1-1190823390
Игорь_З
2007-09-26 20:16
2007.12.16
Мерцание ListView


15-1194890946
@!!ex
2007-11-12 21:09
2007.12.16
Спасибо, товарищи!


2-1195649229
{ент
2007-11-21 15:47
2007.12.16
Размер текста