When I click on a label, it brings up my child form. The child form has two images.
What I would like is the child form, to always show in the exact location relative to the Parent no matter where the Parent is located
I can set the Start Position of the Child to CenterParent but it'd look much better, if it was always directly above the label
Start position of ChildForm relative to ParentForm
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Start position of ChildForm relative to ParentForm
The $label from the main form appears it cannot be called in the childform
Re: Start position of ChildForm relative to ParentForm
You have to pass the location to the child form. The child cannot access a parent by any normal means.
In the form load you can also try this:
$this.Location = $this.Parent.Controls['label1'].Location
I suspect you will have to calculate the screen relative location referenced to the parent form and the label.
In the form load you can also try this:
$this.Location = $this.Parent.Controls['label1'].Location
I suspect you will have to calculate the screen relative location referenced to the parent form and the label.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Start position of ChildForm relative to ParentForm
Here is project that demonstrates how to position a child relative to a parent.
- Attachments
-
- Test-ChildPosition.zip
- (102.33 KiB) Downloaded 118 times
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Start position of ChildForm relative to ParentForm
I was surprised how small of increments my height and width needed to change. But we have success. Some brilliant work! Thank you.