//必须先加载图片,然后执行
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:Halconpatras";
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);
}