Einzelnen Beitrag anzeigen

Volker Z.

Registriert seit: 3. Dez 2012
Ort: Augsburg, Bayern, Süddeutschland
419 Beiträge
 
Delphi XE4 Ultimate
 
#3

AW: TListView Änderung der Größe von Collumns verhindern

  Alt 11. Mai 2015, 21:55
Hallo,

wenn Du das Ändern der Spaltenbreite im der Listview unterbinden möchtest, dann musst Du Dich IMHO in die WMNotify einhängen und es dort verhindern. Zum Beispiel so:

Delphi-Quellcode:
interface

uses
  [...]

type
  TListView = class(Vcl.ComCtrls.TListView)
  private
    procedure WMNotify (var Msg : TWMNotify); message WM_NOTIFY;
  end;

  TForm1 = class(TForm)
    ListView1: TListView;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

implementation

{$R *.dfm}

uses
  Winapi.CommCtrl;

procedure TListView.WMNotify (var Msg : TWMNotify);
var
  c : Integer;
begin
  c := Msg.NMHdr^.code;
  if (c = HDN_BEGINTRACKA) or (c = HDN_BEGINTRACKW) then
    Msg.Result := 1
  else
    inherited
end;
Die Eigenschaften MinWidth bzw. MaxWidth kannst Du dann getrost ignorieren.

Gruß
Volker Zeller
  Mit Zitat antworten Zitat