Note that there are some explanatory texts on larger screens.

plurals
  1. POMove contents of Form when a Control is re-Located
    primarykey
    data
    text
    <p>Let's just say that I have <em>many</em> controls on my Form, and when a User clicks on one of them, its height will expand. This means that, currently, when this clicked-control expands, other controls below it will become overlapped by the expanded control.</p> <p>But what I want to happen, is for each Control below the expanded control to slide down, so that they are below the expanded control again.</p> <p>I know how to handle sliding, but I just don't know how to make every control except for one move everytime a given control is moved.</p> <p>Any help at all is greatly appreciated, thank you!</p> <p>This is what I was thinking:</p> <pre><code>void newOrderReceived(object sender, EventArgs e) { foreach(Control OrderNotificationBox in OrdersPanel.Controls) { if(OrderNotificationBox is NotificationBox) // Checks to see if the control is a NotificationBox { // Add my code to slide controls down. } } } </code></pre> <p>But... How do I know if the control is <em>below</em> the expanded control?</p> <p>Is this how I should go about changing the location of all controls below the expanded control?</p> <p>Edit: Just had a thought, to check to see if a NotificationBox is below the Expanded NotificationBox, see revised code below:</p> <pre><code>void newOrderReceived(object sender, EventArgs e) { foreach(Control OrderNotificationBox in OrdersPanel.Controls) { if(OrderNotificationBox is NotificationBox) // Checks to see if the control is a NotificationBox { if(OrderNotificationBox.Location.Y &lt;= ExpandedNotificationBox.Location.Y + ExpandedNotificationBox.Size.Width) { // Add my code to slide controls down. } } } } </code></pre> <p>But would this be sufficient? Currently, this is working, so I guess I just answered my own question. But, isn't there a better way to do this? A more elegant/efficient way?</p> <p>Here's a sample of how it should look: <img src="https://i.stack.imgur.com/gp2fj.png" alt="Expanded Control with properly re-located controls"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload