Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have created a winform application using c# and have a status strip which displays the time at the bottom. I also have a check-box right on top of the status strip.

When a user clicks to set the check box status to checked, the windows form re-sizes to display a set of advanced options for the user. When this event occurs, the status strip (which is docked to the bottom should redraw itself a location below the expanded panel.
The problem is that the status strip is initially visible when I debug the application but when I click on the check box the status strip disappears. When I click anywhere outside the application and then click on the current application again the status strip has been re-drawn and is now visible. I tried using my code to redraw the status bar each time the check-box is clicked but still did not help my issue.

C#
if (checkBoxAdvProperties.Checked)
           {
               statusStrip1.Location = new Point(3, 704);
               statusStrip1.Dock = DockStyle.Bottom;               
               statusStrip1.Show();
               statusStrip1.Visible = true;
               this.ClientSize = new System.Drawing.Size(1037, 755);

               //I tried this as well
               //StatusStrip newStatusStrip = new StatusStrip();
               //newStatusStrip .Location = new Point(3, 704);
               //newStatusStrip .Dock = DockStyle.Bottom;  
               //newStatusStrip.Items.AddRange(new                        System.Windows.Forms.ToolStripItem[] {this.toolStripStatusLabel1,this.toolStripStatusLabel2});
               //newStatusStrip .Show();
           }
C#

Posted
Updated 14-Jan-13 0:31am
v2
Comments
StM0n 14-Jan-13 7:04am    
Have you tried to make a prototype for your problem? Sometimes it helps if you're simplify your application down to the propblem to be solved. In this case, just make an app which contains just the necessary items like the statusstrip and your expendable...
Alan N 14-Jan-13 9:10am    
What is displayed where the status strip should be when the problem occurs?
Member 9557085 15-Jan-13 4:28am    
The area where the status strip should be present is the empty, i.e. the background form is visible. I tried to redraw the status bar as well but it did not help.

1 solution

Hi,

I think this is just a painting problem.

C#
if (checkBoxAdvProperties.Checked)
           {
               statusStrip1.Location = new Point(3, 704);
               statusStrip1.Dock = DockStyle.Bottom;
               statusStrip1.Show();
               statusStrip1.Visible = true;
               this.ClientSize = new System.Drawing.Size(1037, 755);
this.Refresh();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900