1.加载VisionPro的‘.vpp‘文件
1.1加载ViaionPro的控件,命名为‘cogToolBlockEditV21‘
1.2 加载文件程序 参数:“path” VisionPro的‘.vpp‘文件保存地址
private void button24_Click(object sender, EventArgs e) { try { //加载调试所用VPP cogToolBlockEditV21.Subject = CogSerializer.LoadObjectFromFile("path") as CogToolBlock; cogToolBlockEditV21.Subject.Ran += new EventHandler(Subject_Ran); txtStatus.Text = "加载成功"; } catch (Exception ex) { txtStatus.Text = "加载失败"; } }
void Subject_Ran(object sender, EventArgs e) { }
2.保存VisionPro的‘.vpp‘文件
private void btnSave_Click(object sender, EventArgs e) { CogSerializer.SaveObjectToFile(cogToolBlockEditV21.Subject, "path"); MessageBox.Show("保存成功"); }