博客
关于我
materialTabControl1_SelectedIndexChanged的使用
阅读量:793 次
发布时间:2023-02-07

本文共 3277 字,大约阅读时间需要 10 分钟。

MaterialTabControl1_SelectedIndexChanged事件处理

        // TabControl索引变化事件处理程序        private void materialTabControl1_SelectedIndexChanged(object sender, EventArgs e)        {            // 切换至分析表页面            if (this.materialTabControl1.SelectedIndex == 2)            {                // 初始化listview1和listview2                DirectoryInfo matDirInfo1 = new DirectoryInfo(Path.Combine(tbSavedDir.Text.Trim(), "过杀图像"));                FileInfo[] files1 = matDirInfo1.GetFiles();                foreach (var item in files1)                {                    lstv1.Items.Add(new ListViewItem(new string[] { item.FullName }, 0));                }                DirectoryInfo matDirInfo2 = new DirectoryInfo(Path.Combine(tbSavedDir.Text.Trim(), "漏失图像"));                FileInfo[] files2 = matDirInfo2.GetFiles();                foreach (var item in files2)                {                    lstv2.Items.Add(new ListViewItem(new string[] { item.FullName }, 0));                }                UpdateEscapeOverKill();                pictureBox6.Image = Image.FromFile(@"D:\1.png");                pictureBox7.Image = Image.FromFile(@"D:\2.png");            }            // 切换至真值表页面            else if (this.materialTabControl1.SelectedIndex == 1)            {                // 获取并解析真值表数据                JObject allDefectInfo = JSONHelper.ReadJSON(Path.Combine(tbSavedDir.Text.Trim(), "真值表.json"));                int imgNum = allDefectInfo.Count;                // 提取缺陷信息                List
allDefectList = new List
(); foreach (var item in allDefectInfo) { string defectName = (string)item.Value["defectName"]; string[] defectNames = defectName.Split('+'); foreach (var item2 in defectNames) { allDefectList.Add(item2); } } // 统计缺陷类型和数量 var counts = allDefectList.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count); // 初始化数据绑定列表 List
defectCategoryList = new List
(); List
defectDefectCountList = new List
(); foreach (var item in counts) { defectCategoryList.Add(item.Key); defectDefectCountList.Add(item.Value); } // 更新图表数据 cartesianChart1.Series = new SeriesCollection(); ColumnSeries chartSeries = new ColumnSeries(); chartSeries.Title = "缺陷数量"; chartSeries.DataLabels = true; chartSeries.Values = new ChartValues
() { }; cartesianChart1.Series.Add(chartSeries); foreach (var item in defectDefectCountList) { chartSeries.Values.Add(item); } if (cartesianChart1.AxisX.Count == 0) { cartesianChart1.AxisX.Add(new Axis { Title = "缺陷类型", Labels = defectCategoryList, Separator = new Separator { Step = 1 } }); } else { cartesianChart1.AxisX[0] = new Axis { Title = "缺陷类型", Labels = defectCategoryList, Separator = new Separator { Step = 1 } }; } if (cartesianChart1.AxisY.Count == 0) { cartesianChart1.AxisY.Add(new Axis { Title = "个数", LabelFormatter = value => value.ToString("N") }); } else { cartesianChart1.AxisY[0] = new Axis { Title = "个数", LabelFormatter = value => value.ToString("N") }; } //

转载地址:http://zkyfk.baihongyu.com/

你可能感兴趣的文章
MinIO无法上传文件,Content-Length(XX) and stream length(0) disagree
查看>>
MinIO生成带签名的文件下载链接
查看>>
MinIO的分布式系统是如何确保数据一致性的?
查看>>
miniUI ExcelExport导出JAVA实现
查看>>
miniUI mini-monthpicker ie8兼容性问题
查看>>
MiniUI treeGrid 树节点展开和不展开的性能差别很大
查看>>
Mint-Ui 时间组件,比较时间
查看>>
Mint-UI中Invalid prop: type check failed for prop "value". Expected String, got Array.解决方案
查看>>
Min_25筛
查看>>
MIPS广告牌发布节目后显示未下载,节目发布不成功
查看>>
Mirantis OpenStack fuel 物理机部署
查看>>
MISCONF Redis is configured to save RDB snapshots, but it is currently not a
查看>>
Missing artifact com.sun:tools:jar:1.5.0解决的方法
查看>>
mit oracle v2.2,Oracle Exadata Database Machine X2-2 Hardware
查看>>
MIT-JOS系列6:用户环境(二)
查看>>
Mitel MiCollab 企业协作平台 任意文件读取漏洞复现(CVE-2024-41713)
查看>>
MIT研制出空陆自动切换型无人机技术,构想多年的“飞行车”或将实
查看>>
miui12怎么自定义开机动画_一篇文章看懂Redmi Note 7/7 Pro新增MIUI 12十大暖心功能...
查看>>
MixPHP_数据库操作基类
查看>>
MyEclipse启动失败
查看>>