Arian Kulp's Blog
opinion, insight, and occasional code

Stupid Forms Tricks!

Friday, April 18, 2008 4:01 PM

Wow.  I've just learned something that should be a no-brainer.  It's not like this has happened that often, but there have been a few times that I've tried to use a StatusStrip control in a UI (Dock = Bottom) with some other control filling the rest of the form (Dock=Full).  I've always given up since the Fill control always goes behind the StatusStrip (presumably any Dock=Bottom control).  My "solution" has been to eliminate the docking and size the larger control explicitly above the StatusStrip, then anchor it in all directions.  Not a great solution.

The anchor handles of the Fill component are at the bottom of the form

Figure 1:Notice the anchor handles (of the Fill component) at the bottom

The solution to this dilemma is so simple I'm just kicking myself!  It turns out that all you need to do (with both controls docked properly) is select the Fill control and bring it to front.  That's it:

The bring-to-front button is in the Layout toolbar

Figure 2: The "Bring to Front" button

Not the larger control is properly set in z-order.

The Fill component is now placed above the StatusStrip as expected

Figure 3: Now the anchor handles are in the right place!

Thought I've searched for a better solution in the past, I've always given up before finding it.  Lo and behold, this was my lucky day!

 

Source: http://www.tek-tips.com/viewthread.cfm?qid=1457018&page=3




Feedback

# re: Stupid Forms Tricks!

Nice tip, I'll have to remember that.

I used to get around this in a different way: I found out the the order of the docked elements in the generated code controlled which was docked to what. So I would go and cut and paste some of the generated code and things would work.

This should be much easier. I wonder if the bring to front button just does the same thing behind the scenes. 4/30/2008 12:05 PM | David Hogue



Post a comment






 

Please add 8 and 4 and type the answer here: