halcon 图片加载和设置XY轴滑动块的先后顺序
//必须先加载图片,然后执行
hWndControl.setGUICompRangeX( new int[]{ XTrackBar.Minimum,
XTrackBar.Maximum},
XTrackBar.Value );
hWndControl.setGUICompRangeY( new int[]{ YTrackBar.Minimum,
YTrackBar.Maximum},
YTrackBar.Maximum-YTrackBar.Value);
private void SmartWindow1Form_Load(object sender, System.EventArgs e) { hWndControl = new HWndCtrl(viewPort); Init(); } private void Init() { String fileName = @"E:\Halcon\patras"; HImage image; try { image = new HImage(fileName); } catch(HOperatorException) { MessageBox.Show("Problem occured while reading file!", "SmartWindow1", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } hWndControl.addIconicVar(image); hWndControl.repaint(); hWndControl.setGUICompRangeX( new int[]{ XTrackBar.Minimum, XTrackBar.Maximum}, XTrackBar.Value ); hWndControl.setGUICompRangeY( new int[]{ YTrackBar.Minimum, YTrackBar.Maximum}, YTrackBar.Maximum-YTrackBar.Value); }
posted on 2018-07-11 10:55 qq1151219115 阅读(178) 评论(0) 编辑 收藏 举报