//必须先加载图片,然后执行
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); }
原文地址:https://www.cnblogs.com/qq1151219115/p/9293325.html
时间: 2024-10-11 05:03:56