Autor Beitrag
Jojojoxx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Sa 07.01.06 23:37 
Hallo!

ich hab folgendes Problem.
Wenn ich neine Form an eine beliebige Position ziehe und die .exe dann kompiliere, ist das Fenster beim Programmstart ja auch an dieser Stelle. Starte ich das Programm nun auf einem PC mit einer niedrigeren Bildschirmauflösung, kann es passieren, dass das Fenster gar nicht sichtbar ist, also "außerhalb des Bildschirms liegt".
Kann man irgendwie das Fenster zentriert auf dem Bildschirm laden lassen!?
Danke euch!

mfg

Jojo
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: Sa 07.01.06 23:42 
zentriern tust du mit
ausblenden Delphi-Quelltext
1:
2:
Form1.Left:= screen.Wdith div 2;
Form1.Top:= screen.Hitght div 2;

aber ich glaube was du suchst is nicht das exakt zentrierte, als einfach für left und top die position angeben wo dus gern hättest
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Sa 07.01.06 23:46 
Vielen Dank! Es Funktioniert!!!!

mfg

Jojo
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Sa 07.01.06 23:59 
das kannst du noch weiter optimieren, etwa so:
ausblenden Delphi-Quelltext
1:
2:
Left := (Screen.Width div 2) - (Form1.Width div 2);
Top  := (Screen.Height div 2) - (Form1.Height div 2);
Chris Maslowski
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109



BeitragVerfasst: So 08.01.06 00:30 
Ist dieses div dann die Anzahl der Pixel zum Rand?? Weil dann wäre das doch an den PC's mit anderer Auflößung an einer anderen Stelle.
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 08.01.06 00:44 
nö das div is dasselbe wie ein /
also einfach nur ein durch
wenn ich mein buch find schreib ich noch was die genau dazu sagen

EDIT:
oha div wird für ganzzahl division verwendet :)
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 08.01.06 11:53 
Wie wärs denn ganz einfach mit Form1.Position:=poDesktopCenter;
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 08.01.06 12:10 
Als ich den Beitrag gelesen habe, habe ich gedacht:
"Hat den noch niemand gemerkt, dass es extra dafür im Objektinspektor ne Einstellung gibt*?"
Zum Glück hat es Blackheart gewusst :wink: .

Nur eins würd ich ändern: ScreenCenter.
Wenn einer 2 Monitore hat, ist es dann auf einem Monitor zentriert
und nicht halb auf Monitor 1 und halb auf Monitor 2.



*Ich wusste es lange Zeit auch nicht ;-).

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)