C#状态栏设计丢失的恢复

C#状态栏设计丢失的恢复方法


程序症状:

由于状态栏图片资源丢,造成程序出错,进而造成以前设计的状态栏全部无显示。

解决办法:

1)在窗体属性下拉列表框内可以找以前设计的控件,复制一个控件名。

2)打开程序的查找对话框粘贴查到查找里,找整个解决方案,可以在窗体的xxx..Designer.cs找到控件的布局。

3)在每一个控件布局下加            

this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.控件名});

列如:

            // 
            // toolStripStatusLabel1
            // 
            this.toolStripStatusLabel1.AutoSize = false;
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new System.Drawing.Size(71, 17);
            this.toolStripStatusLabel1.Text = "站点连接数:";
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripStatusLabel1});


切出xxx..Designer.cs窗口时,程序会自动整理成4)的样式。

4)也可以在控件布局下面找到

            // 
            // statusStrip1 --状态栏名称
            // 
在它下面整体添加如下:

            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripStatusLabel1,
            this.Status2,
            this.toolStripStatusLabel4,
            this.toolStripStatusLabel6,
            this.toolStripStatusLabel2,
            this.toolStripStatusLabel3,
            this.toolStripStatusLabel5,
            this.toolStripStatusLabel7,
            this.toolStripDropDownButton1,
            this.toolStripDropDownButton2,
            this.toolStripComboBox1,
            this.toolStripStatusLabel9,
            this.toolStripStatusLabel8,
            this.toolStripStatusLabel10});
5)切回状态栏窗体,会看到所有设置都回来了。

6)测试环境vs2010 C#,其它版本没测试,估计类似。





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值