I'm having trouble finding a way to add a textbox (or frankly any new object in general) to a specific location in an existing GUI whilst relocating other objects. I have created a button that allows me to add a new textbox and I have been using this command line to set its location:
$textBox.Location = New-Object System.Drawing.Point($x, $y)
It has worked so far, but my only problem is that I have other objects (labels, buttons, textboxes, etc.) blocking the location of where I want to create the new textbox. So rather than resetting the location of every object manually with the command line above and adding the box, I was wondering if there was a way to move everything simultaneously with one or two lines of code. More specifically, if there was a way to move all objects below a certain object in a GUI easily.
Adding a Textbox to Existing GUI and relocating other objects
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.
Re: Adding a Textbox to Existing GUI and relocating other objects
Are there any examples of these? I’ve never been able to wrap my head around these
Re: Adding a Textbox to Existing GUI and relocating other objects
If you search you will find many examples.
There is one example in the sub-form in the following blog article.
http://tech-comments.blogspot.com/2017/ ... forms.html
Download and run the sample code. Look at the code for the sub-form to see how it dynamically builds a form with a variable number of textboxes and labels. It may appear complicated but, once you understand how it works you will be able to use the techniques in many places and ways.
There is one example in the sub-form in the following blog article.
http://tech-comments.blogspot.com/2017/ ... forms.html
Download and run the sample code. Look at the code for the sub-form to see how it dynamically builds a form with a variable number of textboxes and labels. It may appear complicated but, once you understand how it works you will be able to use the techniques in many places and ways.
Re: Adding a Textbox to Existing GUI and relocating other objects
Thank you for the information! There is also a great YouTube video that gives you the basics if you are new to the FlowLayoutPanel tool.
https://www.youtube.com/watch?v=NxfYFAw0JDs
https://www.youtube.com/watch?v=NxfYFAw0JDs