关于toolStripStatusLabel2

chen123free 2015-12-18 02:07:13
Form1中
private void timer1_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "时间: " + DateTime.Now.ToString();
}

Form3中
public void button1_Click(object sender, EventArgs e)
{
Form1.toolStripStatusLabel2.Text = "XXXXXXX"; //这里有问题
}

问题,form 3的按钮怎么控制Form1的toolStripStatusLabel2的显示
...全文
132 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
BobHe 2015-12-18
  • 打赏
  • 举报
回复
可以把form1中的toolStripStatusLabel2控件改为全局,这样就可以更改了; 或者在form1中增加个更改toolStripStatusLabel2的方法,然后在form3中调用。
批量删除图片透明区 压缩图片功能 public string mSelectPath;//当前选择路径 public Form1() { InitializeComponent(); this.toolStripStatusLabel1.Text = "准备就绪"; } private void button1_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Multiselect = true; open.Filter = "图片|*.png"; if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Tools.Export(new List(open.FileNames), "D://output"); } this.toolStripStatusLabel1.Text = "图片压缩完成"; } private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.mSelectPath)) { this.toolStripStatusLabel1.Text = "路径不合法"; } else { Tools.ExportFolder(this.mSelectPath, "D://output"); this.RefershTreeView(); this.toolStripStatusLabel1.Text = "导出完成"; } } private void button3_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.mSelectPath)) { this.toolStripStatusLabel1.Text = "路径不合法"; } else { Tools.ChangeImgName(new DirectoryInfo(this.mSelectPath)); this.RefershTreeView(); this.toolStripStatusLabel1.Text = "重命名操作完成"; } } private void linkLabel1_Click(object sender, EventArgs e) { FolderBrowserDialog fb = new FolderBrowserDialog(); if(fb.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.mSelectPath = fb.SelectedPath; this.textBox1.Text = fb.SelectedPath; this.RefershTreeView(); this.toolStripStatusLabel1.Text = "选择路径:" + this.mSelectPath; } }

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧