Home > Net >  C # OpenFileDialog controls after open the folder, in the open window right-click software error.
C # OpenFileDialog controls after open the folder, in the open window right-click software error.

Time:11-26

This is one of my open the local image features, on the file selection window to choose a picture, use the halcon method showed to the halcon controls, can normal open and display pictures but as long as the user always point to the right mouse button, the software will be an error, and can't capture anomalies,
 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:
  •  Tags:  
  • C#
  • Related