Autor Beitrag
Dragonclaw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Mo 08.10.07 23:36 
Hallo!


Ich suche eine Möglichkeit festzustellen, ob eine Form Scrollbars hat, nämlich die, die auftauchen wenn Form.autoscroll auf true ist.


Vielen Dank für die Antworten.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 09.10.07 00:10 
Hallo,

ein Vorschlag:
ausblenden Delphi-Quelltext
1:
2:
if Width-(GetSystemMetrics(SM_CXSIZEFRAME)*2) <> ClientWidth then
  //Scroollbar ist visible

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Di 09.10.07 00:48 
mhmm so klappt das nicht: Hab das gerade mal ausprobiert und nen bisschen damit rumgespielt.
Es scheint so zu sein, das SM_CXSIZEFRAME gleich bleibt wenn eine Scrollbar vorhanden ist oder nicht.


Hast du noch irgend eine Idee. Es wäre ja eigentlich auch möglich, alle komponenten durch zu gehen, und gucken ob irgendwo Komp.left + Komp.width > ClientWidth ist, wenn dies der Fall ist, existiert eine Scrollbar.

Allerdings würde ich nur sehr ungerne auf diese Lösung zurück greifen.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 09.10.07 08:50 
Hallo,

ist klar das SM_CXSIZEFRAME gleich bleibt, den GetSystemMetrics(SM_CXSIZEFRAME) liefert die Breite des Rahmens einer Form.

ClientWidth ist die Breite des Clientbereichs der Form.

Width enthält die Breite der gesamten Form,
also Rahmen + Clientbereich + Scrollbar + Rahmen.

Wenn Width-(GetSystemMetrics(SM_CXSIZEFRAME)*2) <> ClientWidth ist, dann ist die vertikale Scrollbar sichtbar.

Könntest die Bedingung auch so ausdrücken:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var Rahmen : Integer;
begin
  Rahmen := GetSystemMetrics(SM_CXSIZEFRAME);
  if Width - Rahmen - ClientWidth - Rahmen <> 0 then
    //Scroollbar ist visible

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Di 09.10.07 13:41 
Okay, für die Vertikale funktioniert das jetzt. Vielen Dank schon mal.

Allerdings funktioniert das gleiche NICHT für die Horizentale.

Ich habe leider auf anhieb, keine Möglichkeit gefunden die pixel höhe vom oberen Rahmen herauszufinden.

Weißt du vllt. ob es sowas gibt?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 09.10.07 13:46 
Die Höhe der Caption bekommt man mit GetSystemMetrics(SM_CYCAPTION), die Höhe des Rahmens mit GetSystemMetrics(SM_CYFrame).

_________________
We are, we were and will not be.
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Di 09.10.07 13:58 
Vielen Dank!

Hier nochmal die beiden Abfragen:

Horizontale Scrollbar:
ausblenden Delphi-Quelltext
1:
Height - ClientHeight - GetSystemMetrics(SM_CYCAPTION) - 2*GetSystemMetrics(SM_CYFrame) <> 0					


Vertikale Scrollbar:
ausblenden Delphi-Quelltext
1:
Width - ClientWidth - 2 * GetSystemMetrics(SM_CXSIZEFRAME) <> 0