try
{
Ofd_Picture. Filter="(*. BMP; *. PNG; *.jpg; | * *. Tif). BMP; *. PNG; *.jpg; *. Tif ";
If (ofd_Picture ShowDialog ()==DialogResult. OK)
{
//String path=ofd_Picture. FileName;
If (m_bTStartCollecting)
{
M_hTelecentreCamera. StopCollecting ();
M_bTStartCollecting=false;
}
//pb_Horizontal. ImageLocation=path;
Try
{
M_hOriginalHorizontalImg. The Dispose ();
}
The catch (Exception)
{
}
M_hOriginalHorizontalImg. GenEmptyObj ();
HOperatorSet. ReadImage (out m_hOriginalHorizontalImg, ofd_Picture FileName);
DisplayPicture (m_hOriginalHorizontalImg, hwc_Horizontal. HalconWindow);
}
The else
{
return;
}
}
The catch (Exception ex)
{
MessageBox. Show (" open image failed! ;" + ex. Message);
}
Debugging and running of the Debug time in "the if (ofd_Picture. ShowDialog ()==DialogResult. OK)" here to throw an exception, and you won't try to catch the exception, and direct the pop-up prompts that triggered a breakpoint, as shown in figure:
Press f11 step once not to jump to catch handle exceptions but directly submitted to the NTDLL. DLL error: