I am using a WinGridBagLayoutPanel which contains 40 UltraButtons (4 columns and 10 rows). We are allowing the user to design the screen and set the SpanX and SpanY. When this is set is there anyway to automatically hide the buttons that will be covered by the button where the SpanX and SpanY was just set? Maybe an event that fires or something.
Right now I loop through the WinGridBagLayout Controls collection and analyze the OriginX, OriginY, SpanX and SpanY of the button that was just changed. I am hoping there is an easier way.
Any direction would be great.
Just to follow up on the above post. I have run into an issue where when hiding the buttons if all of the buttons on the y axis are hidden due to the buttons above them having a SpanY greater than 1 the entire y axis is removed. This results in the buttons above where the SpanY was GT 1 to appear to be cutoff. Is there a way to prevent this from happening? If I disable the buttons instead of hiding them I do not see the problem but the issue then is the buttons where the Span GT 1 are not see in full size as the disabled buttons bleed through.
Hi Roger,
I don't beleive there is any easier way to determine which control are hidden by the layout. The GridBagLayoutPanel certainly does not expose this information. So you would have to do what you are doing and loop through the items, checking the spans and origins.
Regarding your second question, the layout is optimized to remove any logical rows where nothing exists or nothing is visible.
Having said that, I'm having a hard time wrapping my head around exactly what you are doing and what's happening there. I can't see why any controls should be cut off, unless maybe the MinimumSize is such that there is not enough room inside the control.
If you can post a small sample project demonstrating what's happening, I'd be happy to take a look at it for you.