当前位置: 首页 > wzjs >正文

上海软件培训网站建设seo顾问阿亮

上海软件培训网站建设,seo顾问阿亮,开发软件自学步骤,东莞专业建站公司费用在实际项目中为方便了解视觉软件的使用性,可能需要添加一些小而稍微实用的功能:一个StipStatus控件上的Label按钮属性Text需要修改并保存,软件重启后能够自动加载修改后的属性名。 定义变量 public static string controlsText System.Windows.Forms.A…

在实际项目中为方便了解视觉软件的使用性,可能需要添加一些小而稍微实用的功能:一个StipStatus控件上的Label按钮属性Text需要修改并保存,软件重启后能够自动加载修改后的属性名。

定义变量

public static string controlsText = System.Windows.Forms.Application.StartupPath + "\\相关属性\\";
//子窗体窗口属性名修改private string FilePathText = VProClass.controlsText + "窗口属性名.txt";

主窗体中的代码

 #region 修改子窗体窗口属性 名private void SaveStatusLabelsText(string text, int toolRow){// 读取文件的所有行string[] rowLines = System.IO.File.ReadAllLines(FilePathText);// 创建一个新的字符串列表,用于存储更新后的内容List<string> newLines = new List<string>();try{// 插入内容到指定位置 if (rowLines.Length >= 0)//需要考虑文本为空的情况{using (StreamWriter writer = System.IO.File.AppendText(FilePathText)){if (toollabelTag == 1)writer.WriteLine(text);if (toollabelTag == 2)writer.WriteLine(text);if (toollabelTag == 3)writer.WriteLine(text);if (toollabelTag == 4)writer.WriteLine(text);if (toollabelTag == 5)writer.WriteLine(text);if (toollabelTag == 6)writer.WriteLine(text);}}// 插入内容到指定位置 if (rowLines.Length == Convert.ToInt32(ValuePropagation.count)){for (int g = 0; g < rowLines.Length; g++){if (g == toolRow - 1){rowLines[g] = text;}//newLines.Add(rowLines[g]);}// 将更新后的内容写回到文件中System.IO.File.WriteAllLines(FilePathText, rowLines);}}catch (Exception ex){MessageBox.Show($"保存文本时出错:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}private void LoadStatusLabelsText(){if (System.IO.File.Exists(FilePathText)){try{using (StreamReader reader = new StreamReader(FilePathText)){// 读取文件的所有行到一个字符串数组中string[] lines = System.IO.File.ReadAllLines(FilePathText);for (int k = 0; k < lines.Length; k++){if (k == 0)displayControls[0].相机编号1.Text = reader.ReadLine();if (k == 1)displayControls[1].相机编号2.Text = reader.ReadLine();if (k == 2)displayControls[2].相机编号3.Text = reader.ReadLine();if (k == 3)displayControls[3].相机编号4.Text = reader.ReadLine();if (k == 4)displayControls[4].相机编号5.Text = reader.ReadLine();if (k == 5)displayControls[5].相机编号6.Text = reader.ReadLine();}}}catch (Exception ex){MessageBox.Show($"加载文本时出错:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}}public void clearLabelText(int toolTag){if (System.IO.File.Exists(FilePathText)){try{using (StreamReader reader = new StreamReader(FilePathText)){// 读取文件的所有行到一个字符串数组中List<string> linesRow = new List<string>(System.IO.File.ReadAllLines(FilePathText));if (toolTag == 1 && toolTag < linesRow.Count){string specifiedLineRow = linesRow[toolTag - 1];if (specifiedLineRow != null){linesRow.RemoveAt(toolTag - 1);//删除指定行}}if (toolTag == 2 && toolTag < linesRow.Count){string specifiedLineRow = linesRow[toolTag - 1];if (specifiedLineRow != null){linesRow.RemoveAt(toolTag - 1);//删除指定行}}if (toolTag == 3 && toolTag < linesRow.Count){string specifiedLineRow = linesRow[toolTag - 1];if (specifiedLineRow != null){linesRow.RemoveAt(toolTag - 1);//删除指定行}}if (toolTag == 4 && toolTag < linesRow.Count){string specifiedLineRow = linesRow[toolTag - 1];if (specifiedLineRow != null){linesRow.RemoveAt(toolTag - 1);//删除指定行}}if (toolTag == 5 && toolTag < linesRow.Count){string specifiedLineRow = linesRow[toolTag - 1];if (specifiedLineRow != null){linesRow.RemoveAt(toolTag - 1);//删除指定行}}if (toolTag == 6 && toolTag < linesRow.Count){string specifiedLineRow = linesRow[toolTag - 1];if (specifiedLineRow != null){linesRow.RemoveAt(toolTag - 1);//删除指定行}}}}catch (Exception ex){MessageBox.Show($"加载文本时出错:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}}private void 相机编号1_Click(object sender, EventArgs e){//输入Text属性名var label = sender as ToolStripStatusLabel;toollabelTag = 1;if (label != null){// 弹出输入框让用户输入新的文本 input = Microsoft.VisualBasic.Interaction.InputBox("请输入新的文本:", "修改子窗体名", label.Text);if (!string.IsNullOrEmpty(input)){label.Text = input;clearLabelText(toollabelTag);// 保存修改后的文本 SaveStatusLabelsText(label.Text, toollabelTag);}}}
#endregion

主窗体Load事件中添加

//修改子窗体名displayControls[0].相机编号1.Click += 相机编号1_Click;// 加载保存的文本 LoadStatusLabelsText();
http://www.dtcms.com/wzjs/468380.html

相关文章:

  • 做测试题的网站百度关键词排名联系方式
  • 网站定制服务网络营销工程师是做什么的
  • 购物网站模版html武汉全网营销推广公司
  • 我想做自己网站怎么做seo平台怎么样
  • 泰安网站设计培训学校加盟费用
  • 海口网站建设哪家专业优秀网站设计欣赏
  • 网站设计专业公司价格项目推广平台有哪些
  • 医院网站建设费用企业网络营销方法
  • 如何运营网站百度移动seo首选帝搜软件
  • 花里胡哨的网站广州企业网站seo
  • 做调查问卷赚钱注册网站湘潭网站seo磐石网络
  • 济南网站建设认可搜点网络山东潍坊疫情最新消息
  • 做直播教程的网站nba最新新闻消息
  • 自己做外贸网站十大广告公司
  • 做网站的流程方法百度网站域名注册
  • 做网站开发电脑配置企业网站推广注意事项
  • 天津网站建设公司推广资源整合平台
  • 营销型集团网站建设全网营销推广怎么做
  • 南宁网站建设nnit30佛山优化网站关键词
  • 动态网站的制作流程全网营销式网站
  • 哈尔滨市住房和城乡建设局网站百度关键词价格查询
  • 北京广告山东seo推广公司
  • 深圳 seo 外贸网站建设 多语种交换友情链接的途径有哪些
  • 不知道我自己的网站的ftp账号企业微信营销系统
  • 网上书店网站开发关键字参数
  • 做海报 画册的素材网站百度seo排名优化软件分类
  • 长春哪里做网站好广西seo关键词怎么优化
  • 网网站基础建设优化知识网络营销工程师是做什么的
  • 德国站有哪些做站外秒杀的网站长春seo网站排名
  • 上海网站建设自学今日头条热搜榜前十名