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

彩票网站如何建设网站内部优化有哪些内容

彩票网站如何建设,网站内部优化有哪些内容,中国电子建设公司网站,宣传单设计在实际项目中为方便了解视觉软件的使用性,可能需要添加一些小而稍微实用的功能:一个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/211691.html

相关文章:

  • 宁波随身云网络科技有限公司优化新十条
  • 深圳哪个公司做网站好网络营销的基本职能
  • 网站建设结构图下载全能搜
  • 浙江手机版建站系统开发刚刚刚刚刚刚刚刚刚刚刚刚刚刚
  • 做win精简系统的网站google登录入口
  • wordpress待发布整站优化推广
  • 建邺网站建设现在有哪些推广平台
  • web网站开发考试题库答案搜索引擎大全排行榜
  • 武汉建设网站哪家好国家高新技术企业查询
  • 广州开发网站建设seo岗位
  • wordpress会员文章兰州seo优化
  • 专业建设规划及实施方案seo网站的优化方案
  • 做cover用什么网站优化设计单元测试卷
  • 国产尺码和欧洲尺码表2023自己怎么做关键词优化
  • 永久免费网站赣州网站seo
  • 专业网站建设收费网站外链推广平台
  • 石家庄网站建设咨询权威解读当前经济热点问题
  • 骨干专业建设验收网站织梦seo排名优化教程
  • 做中东服装有什么网站谷歌seo 外贸建站
  • 网站logo织梦怎么做怎么推广一个平台
  • 检察院门户网站建设天津谷歌优化
  • 柳市网站优化成都调查事务所
  • 做独立网站需要软件吗新闻头条今日要闻国内新闻最新
  • 专业的网站开发服务上海优化排名网站
  • 电视网站后台管理系统漏洞自媒体平台哪个收益高
  • 设计制作一个企业类型网站搜狗关键词排名查询
  • 品牌企业网站建设公司免费发布推广的网站有哪些
  • 广州 海珠 建网站使用最佳搜索引擎优化工具
  • 新网站建设的感想seo优化诊断工具
  • 做视频网站多大服务器谷歌下载