//引用如下两个命名空间using Cognex.VisionPro;
using Cognex.VisionPro.Display;
// 初始化图像
private void InitializeShapes()
{ //声明矩形
CogRectangle cgRect =
new CogRectangle(); //声明圆形
CogCircle cgCirc =
new CogCircle();
//设置矩形的长宽及 X长度 Y长度
cgRect.X =
150;
cgRect.Y =
150; //设置显示的颜色
cgRect.Color =
CogColorConstants.Green; //选择空间名称(我也不太懂,知道的麻烦告诉下)
cgRect.SelectedSpaceName =
"*"; // 设置可以交互性
cgRect.Interactive =
true;
// Allow user to change the size only 只允许用户改变尺寸
cgRect.GraphicDOFEnable =
CogRectangleDOFConstants.Size;
cgCirc.CenterX =
220;
cgCirc.CenterY =
220;
cgCirc.Color =
CogColorConstants.Blue;
cgCirc.SelectedSpaceName =
"*";
cgCirc.Interactive =
true;
// Allow the user to change the radius only
cgCirc.GraphicDOFEnable =
CogCircleDOFConstants.Radius;
// 将图像显示在CogDisPlay 控件上
cogDisplay1.InteractiveGraphics.Add(cgCirc, null,
false);
cogDisplay1.InteractiveGraphics.Add(cgRect, null,
false);
}//文件上传一份仅供参考,所用visonpro9.0 .NET4.0版本
转载于:https://www.cnblogs.com/MyVision/p/11389063.html
相关资源:VisionPro视觉检测开发学习资料.rar