![]() |
Listbox Scrollbar wegmachen?
hi
ich habe eine Listbox auf meiner form und möchte, dass wenn die items über dem sichtbaren hinausgehen die dadurch kommende Scrollbar weghaben...gibts dafür keine option wie bei memo etc? gruss silent |
weiss es wirklich keiner?
...sorry das ich so schnell nochmal nachfrage, aber mein prog sollte bis 18 uhr fertig sein :\ danke |
Re: Listbox Scrollbar wegmachen?
Zitat:
Zitat:
|
Eigene Kompo ableiten:
Delphi-Quellcode:
Quelle:
type
TNoVScrolllistbox = Class( TListBox ) private procedure WMNCCalcSize( var msg: TMessage ); message WM_NCCALCSIZE; end; procedure TNoVScrolllistbox.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 ); inherited; end; ![]() |
Liste der Anhänge anzeigen (Anzahl: 1)
siehe bild im anhang, ich hab schon eine scrollbar d.h die alte soll weg
jemand der sich in delphi auskennt sagte mir das ich in der SDK hilfe nach "ShowScrollBar" gucken soll, k hab ich:
Delphi-Quellcode:
The ShowScrollBar function shows or hides the specified scroll bar.
BOOL ShowScrollBar( HWND hWnd, // handle of window with scroll bar int wBar, // scroll bar flag BOOL bShow // scroll bar visibility flag ); Parameters hWnd Identifies a scroll bar control or a window with a standard scroll bar, depending on the value of the wBar parameter. wBar Specifies the scroll bar(s) to be shown or hidden. This parameter can be one of the following values: Value Meaning SB_BOTH Shows or hides a window's standard horizontal and vertical scroll bars. SB_CTL Shows or hides a scroll bar control. The hWnd parameter must be the handle of the scroll bar control. SB_HORZ Shows or hides a window's standard horizontal scroll bars. SB_VERT Shows or hides a window's standard vertical scroll bar. bShow Specifies whether the scroll bar is shown or hidden. If this parameter is TRUE, the scroll bar is shown; otherwise, it is hidden. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. Remarks While processing a scroll bar message, an application should not call this function to hide a scroll bar. See Also GetScrollPos, GetScrollRange, ScrollDC, ScrollWindow, SetScrollPos, SetScrollRange aber damit kann ich wirklich nichts anfangen :\ |
danke APP, mal ausprobieren
|
bei mir funzt der code nicht, bei dir?
|
Ja.
1. Form1 2. Button1 draufkleben 3. Code...
Delphi-Quellcode:
20 x Button 1 drücken, dann siehst Du es (oder eben nicht :mrgreen:).
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TNoVScrolllistbox = Class( TListBox ) private procedure WMNCCalcSize( var msg: TMessage ); message WM_NCCALCSIZE; end; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; ListBox2: TNoVScrolllistbox; implementation {$R *.DFM} procedure TNoVScrolllistbox.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 ); inherited; end; procedure TForm1.Button1Click(Sender: TObject); begin listbox2.Items.add('asfkljhasuilfhfuih fuihawiuh waeuifhw'); end; procedure TForm1.FormCreate(Sender: TObject); begin ListBox2 := TNoVScrolllistbox.create(self); Listbox2.SetParent(Form1); end; end. |
thx^^
|
Zitat:
funktioniert super aber wie kann ich es an einer listbox anwenden die schon auf der form ist und nicht zur laufzeit erzeugt wird? Hat sich erledigt :) mfg olli |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:08 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz