Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Scrollbar in einem TTreeview verhinden (https://www.delphipraxis.net/153665-scrollbar-einem-ttreeview-verhinden.html)

Shark99 11. Aug 2010 21:29

Scrollbar in einem TTreeview verhinden
 
Wie kann ich die horizontale Scrollbar in einem TTreeview verhindern?

Shark99 11. Aug 2010 22:07

AW: Scrollbar in einem TTreeview verhinden
 
Ich habe diese Lösung versucht:

Delphi-Quellcode:
procedure TTestTreeview.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  if (Params.Style and WS_VSCROLL) <> 0 then
    Params.Style := Params.Style and not WS_VSCROLL;
  if (Params.Style and WS_HSCROLL) <> 0 then
    Params.Style := Params.Style and not WS_HSCROLL;
end;
jedoch wird der Scrollbalken angezeigt wenn das Treeview anfang leer war und erst später mit Einträgen gefüllt wird.

Ein zweiter Versuch war
Delphi-Quellcode:
ShowScrollBar(ActiveTree.Handle, SB_HORZ, False);
in Form.OnPaint. Leider auch kein Erfolg. Ein manueller (ButtonClick) Aufruf von ShowScrollBar() klappt jedoch.

mkinzler 12. Aug 2010 05:32

AW: Scrollbar in einem TTreeview verhinden
 
BTW. Was ist den so schwer daran, Code-Tags im speziellen die Delphi-Tags für Quellcode ( hier Delphi) zu verwenden?

Shark99 12. Aug 2010 20:14

AW: Scrollbar in einem TTreeview verhinden
 
Habe eine Lösung gefunden:
Delphi-Quellcode:
procedure TTestTreeview.WMNCCalcSize(var msg: TMessage);
var
  style: Integer;
begin
  style := GetWindowLong( handle, GWL_STYLE );
  if (style and WS_VSCROLL) <> 0 then
    SetWindowLong( handle, GWL_STYLE, style and not WS_VSCROLL );
  if (style and WS_HSCROLL) <> 0 then
    SetWindowLong( handle, GWL_STYLE, style and not WS_HSCROLL );
  inherited;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:56 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz