A
abhi.menon
I have a "Plot" button the code associated with which (when Clicked) is
as follows
private: System::Void showPic_Click(System::Object * sender,
System::EventArgs * e)
{
/* code to use Matlab to create a 'bmp' and save to
C:\tmp\matlabFromNET_TRY2\somefile.bmp
*/
Bitmap* MyImage;
MyImage =new Bitmap("C:\\tmp\\matlabFromNET_TRY2\\somefile.bmp");
pictureBox1->Image = MyImage;
}
What basicaly happens is everytime the button is clicked the file
'somefile.bmp' is modified by a Matlab code peice at the start pf the
function, and this file is reloaded into a pictureBox named
'pictureBox1'. The issue I am having is that the first time the button
is clicked the expected image is loaded, but the second time the button
is clicked the old image remains. This is because the bmp is locked
when its loaded into the picture box and no other user or the Matlab
code at the beginning can save changes to the bmp when the button is
clicked again. How would I free the Bitmap at the end of the function
to ensure that the next time this button is clicked, Matlab will be
able to make changes to the 'bmp'
as follows
private: System::Void showPic_Click(System::Object * sender,
System::EventArgs * e)
{
/* code to use Matlab to create a 'bmp' and save to
C:\tmp\matlabFromNET_TRY2\somefile.bmp
*/
Bitmap* MyImage;
MyImage =new Bitmap("C:\\tmp\\matlabFromNET_TRY2\\somefile.bmp");
pictureBox1->Image = MyImage;
}
What basicaly happens is everytime the button is clicked the file
'somefile.bmp' is modified by a Matlab code peice at the start pf the
function, and this file is reloaded into a pictureBox named
'pictureBox1'. The issue I am having is that the first time the button
is clicked the expected image is loaded, but the second time the button
is clicked the old image remains. This is because the bmp is locked
when its loaded into the picture box and no other user or the Matlab
code at the beginning can save changes to the bmp when the button is
clicked again. How would I free the Bitmap at the end of the function
to ensure that the next time this button is clicked, Matlab will be
able to make changes to the 'bmp'