Autor Beitrag
g!ml!
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16


[C#] [VB.NET]
BeitragVerfasst: Di 30.09.08 10:58 
Hallo,
ich würde gern wissen, wie man es hinbekommen kann dass die Colums eines LisView sich der Größe der gesamten Form anpassen.

Danke im Vorraus!

mfg

g!ml!
bakachan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 503
Erhaltene Danke: 34

W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
BeitragVerfasst: Di 30.09.08 11:14 
Eine Möglichkeit wäre im SizeChanged-Event des Listviews die Breiten der Columns zu setzen (musst da natürlich auch berechnen).

Vielleicht gibts auch was einfacheres aber mir fällt da gerade keine automatische funktion zu ein.
g!ml! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16


[C#] [VB.NET]
BeitragVerfasst: Do 02.10.08 10:12 
Vielen Dank für den Tipp, es hat funktioniert:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
public void Preise_lstvw_SizeChanged(object sender, System.EventArgs e)
        {
            OENR_h.Width = (Preise_lstvw.Width / 8) - 10;
            FMAutoteile_h.Width = (Preise_lstvw.Width / 8) + 16;
            Alanko_h.Width = (Preise_lstvw.Width / 8) - 10;
            Diff_Alanko_h.Width = (Preise_lstvw.Width / 8) - 10;
            Yabazzo_h.Width = (Preise_lstvw.Width / 8) - 10;
            Diff_Yabazzo_h.Width = (Preise_lstvw.Width / 8) - 10;
            PWANL_h.Width = (Preise_lstvw.Width / 8) + 16;
            Diff_PWANL_h.Width = (Preise_lstvw.Width / 8) + 16;
        }
JüTho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2021
Erhaltene Danke: 6

Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
BeitragVerfasst: Do 02.10.08 11:34 
Kleiner Vorschlag zur Ergänzung: Eine Berechnung, die mehrfach genutzt wird, sollte einmal am Anfang ausgeführt werden. Das dürfte etwas schneller sein (wenn auch nur im Mikrosekunden-Bereich). Wenn Dir später noch eine andere Anpassung einfällt, musst Du nur diese eine Stelle ändern statt in jeder Zeile.
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
public void Preise_lstvw_SizeChanged(object sender, System.EventArgs e)
        {
            int diff = Preise_lstvw.Width / 8;

            OENR_h.Width = diff - 10;
            FMAutoteile_h.Width = diff + 16;
//  usw.
        }

Gruß Jürgen
g!ml! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16


[C#] [VB.NET]
BeitragVerfasst: Mo 06.10.08 11:16 
Danke Jürgen, ich hab's angepasst ^^