Autor Beitrag
Scofield2011
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Windows XP, Windows 7, Windows 8
C#, VBA, VB
BeitragVerfasst: Sa 23.06.12 01:54 
Hallo,

ich habe mal wieder eine Frage.

Und zwar habe ich in einem Projekt ein Hauptform, das man beliebig verschieben kann aber größenmäßig nicht verändern darf. So weit kein Problem.

Jetzt kann man aber von diesem Hauptform aus andere Forms öffnen, die ich gerne abhängig von der Position des Hauptforms positioniert hätte. Zum Beispiel immer 10 Pixel vom linken Rand und 10 vom oberen Rand des Hauptforms nicht wie üblich vom Bildschirmrand. Nach Möglichkeit sollen sie sich nämlich nie außerhalb des Hauptforms befinden.

Leider kenne ich nur die Möglichkeit Forms an absoluten Positionen erscheinen zu lassen, nicht abhängig von anderen Forms.

Vielleicht kann mir jemand den entscheidenden Tipp geben.

Danke jedenfalls schon einmla im Voraus.

Scofield2011
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4799
Erhaltene Danke: 1059

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Sa 23.06.12 09:59 
Hallo Scofield2011,

du mußt halt die Position des Haupt-Formulars mit einberechnen, z.B.
ausblenden C#-Quelltext
1:
subform.Location = new Point(mainForm.Location.X + 10, mainForm.Location.Y + 10);					


P.S: Folgendes ist ein bißchen kürzer und verständlicher:
ausblenden C#-Quelltext
1:
subform.Location = mainForm.Location + new Size(1010);					


Zuletzt bearbeitet von Th69 am So 24.06.12 09:56, insgesamt 2-mal bearbeitet
Scofield2011 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Windows XP, Windows 7, Windows 8
C#, VBA, VB
BeitragVerfasst: So 24.06.12 01:37 
Danke noch einmal.

Dein Tipp hat wie immer zum Ziel geführt.