Vp机器视觉 C#标签,分行版

📅 2026/8/1 20:27:00
Vp机器视觉 C#标签,分行版
Vp机器视觉 C#标签分行版分类IT技术作者樱振宇发布时间2026-07-31 11:13:04导入集合using System.Collections.Generic;//导入集合类里面创建//测试类的标签 private ListCogGraphicLabel TEST_BQ new ListCogGraphicLabel(); public void bq(string[] nr,int X,int Y){//传入字符串数组 //清空数组 TEST_BQ.Clear(); //判断数组是否存在 if(nr.Length 0){ //遍历数组 for(int i 0;nr.Length i;i){ CogGraphicLabel test; test new CogGraphicLabel(); //设置标签的参数 test.Font new Font(微软雅黑, 12); //字体 test.Color CogColorConstants.Red; //设置颜色 test.X 20;//x坐标 if (TEST_BQ.Count 0) { //集合里面有标签 test.X X;//Y坐标 test.Y TEST_BQ.Count * 20 Y; }else{ test.X X;//Y坐标 test.Y 20;//y坐标 } test.Text string.Format({0}, nr[i]); //添加到集合 TEST_BQ.Add(test); } } }执行代码写//添加标签 string[] YingZhenYu new string[] { string.Format({0}, 测试), string.Format({0}, 一下) }; //调用标签; bq(YingZhenYu,50,80);结果屏幕输出//输出标签 //for循环写法 for(int i 0; i TEST_BQ.Count; i) { CogGraphicLabel lab TEST_BQ[i]; // 参数图形运行记录【图像端子名字】图层标识字符串 mToolBlock.AddGraphicToRunRecord(lab, lastRecord, CogImageConvertTool1.InputImage, script); }效果图