Autor Beitrag
yndaso
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 108



BeitragVerfasst: Do 19.02.09 11:10 
Hallo zusammen,

ich habe eine Anwendung für zwei verschiedene Fenstergrößen zu erstellen.

Ich habe nun im Form als Größe die kleinere Größe vorgegeben und die Elemente (Buttons, Panels, Labels)
entsprechend platziert und die Größe dementsprechend kleiner gemacht.

So nun ermittel ich mittels

ausblenden C#-Quelltext
1:
2:
3:
4:
            if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width > 800)
            {
                this.xScale = 2;
            }


Entsprechend der Variable xScale würde ich nun gerne alles ein bisschen Vergrößern.
Wie macht man sowas?
Bisher habe ich für jedes Object die Eigenschaften folgendermaßen neu geschrieben:

ausblenden C#-Quelltext
1:
2:
                        paCyclic.Size = new System.Drawing.Size(612, 230);
                        paCyclic.Location = new System.Drawing.Point(0, 60);


Geht das nicht auch einfacher?
Wenn ich nun für jedes Objekt die Größe manuell setzen muss, dann skalier ich morgen noch...

Vorab Danke!
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 19.02.09 11:24 
Versuch mal, ob Du mit this.Scale(0.5f); brauchbare Ergebnisse bekommst.
(this ist hierbei in einer Klasse mit Vorfahre System.Windows.Forms.Form)
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 19.02.09 11:28 
Ich seh grad, dass die Methode als Deprecated deklariert ist. Man sollte stattdessen:
ausblenden C#-Quelltext
1:
this.Scale(new System.Drawing.SizeF(0.5f,0.5f));					

verwenden.

Wichtig ist: Du designst Dein Formular so, dass es das kleinste ist, und
vergrößerst nur. Verkleinern sieht nicht mehr so schön aus!
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: Do 19.02.09 11:33 
Vieles lässt sich auch automatisch anpassen wenn man Dock / Anchor ordentlich setzt.
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 19.02.09 11:36 
Das ist ein guter Hinweis...

Für was genau brauchst Du das eigentlich?
yndaso Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 108



BeitragVerfasst: Do 19.02.09 12:09 
Danke für die schnelle Hilfe.

das Scale liefert mir ein vollkommen aktzeptables Ergebniss:

ausblenden C#-Quelltext
1:
2:
                SizeF _faktor = new SizeF((float)1.2 , (float) 1.2);
                this.Scale(_faktor);


user profile iconarj hat folgendes geschrieben Zum zitierten Posting springen:
Das ist ein guter Hinweis...

Für was genau brauchst Du das eigentlich?

Die Anwendung ist ein Screen für 2 verschiedene Displays. Ich habe alles nun für das kleine
Display "gemalt" und möchte falls ein größeres Display vorhanden ist alle Panels, Buttons,... etwas vergrößern...