本文介绍了帮助我解决错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请大家帮忙解决此功能中的错误...

私人:System :: Void button1_Click(Object ^ sender,System :: EventArgs ^ e)

{
OpenFileDialog openFileDialog1 = gcnew OpenFileDialog;
this-> openFileDialog1 =(gcnew System :: Windows :: Forms :: OpenFileDialog());
//openFileDialog1-> ShowDialog;




this-> openFileDialog1-> Filter =图像(* .BMP; *.JPG; *.GIF,*.PNG,*.TIFF)| * .BMP; *.JPG; *.GIF; *.PNG; * .TIFF |"+所有文件(*.*)| *.*";


this-> openFileDialog1-> Multiselect = true;

this-> openFileDialog1->标题=选择位置";


DialogResult()dr = this-> openFileDialog1-> ShowDialog;

如果(dr = System :: Windows :: Forms :: DialogResult :: OK)

{
对于每个(openFileDialog1-> FileNames中的(System :: String ^文件)

{

试试

{

PictureBox imageControl = gcnew PictureBox();

imageControl.Height = 100;

imageControl.Width = 100;



图片:: GetThumbnailImageAbort ^ myCallback = gcnew图片:: GetThumbnailImageAbort(ThumbnailCallback);

位图myBitmap = gcnew位图(文件);

图片myThumbnail = myBitmap.GetThumbnailImage(96,96,myCallback(),IntPtr.Zero);

imageControl.Image = myThumbnail;


//PhotoGallery.Control.Add(imageControl);
this->控件-> Add(this-> imageControl);
}

catch(Exception ^ e)

{

MessageBox :: Show(e-> Message,"Error:",MessageBoxButtons :: OK,MessageBoxIcon :: Error);
//MessageBox :: Show(System :: String ^ Error);
}

}

}

}



公共:bool ThumbnailCallback()

{

返回false;

}

Could everyone please help he fixing error in this function...

private: System::Void button1_Click(Object^ sender, System::EventArgs^ e)

{
OpenFileDialog openFileDialog1 = gcnew OpenFileDialog;
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
//openFileDialog1->ShowDialog;




this->openFileDialog1->Filter = "Images (*.BMP;*.JPG;*.GIF,*.PNG,*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF|" + "All files (*.*)|*.*";


this->openFileDialog1->Multiselect = true;

this->openFileDialog1->Title = "Select Location";


DialogResult() dr = this->openFileDialog1->ShowDialog;

if (dr = System::Windows::Forms::DialogResult::OK)

{
for each (System::String ^ file in openFileDialog1->FileNames)

{

try

{

PictureBox imageControl = gcnew PictureBox();

imageControl.Height = 100;

imageControl.Width = 100;



Image::GetThumbnailImageAbort ^ myCallback = gcnew Image::GetThumbnailImageAbort(ThumbnailCallback);

Bitmap myBitmap = gcnew Bitmap(file);

Image myThumbnail = myBitmap.GetThumbnailImage(96, 96, myCallback(), IntPtr.Zero);

imageControl.Image = myThumbnail;


//PhotoGallery.Control.Add(imageControl);
this->Controls->Add(this->imageControl);
}

catch (Exception^ e)

{

MessageBox::Show(e->Message, "Error: ", MessageBoxButtons::OK, MessageBoxIcon::Error);
//MessageBox::Show(System::String^ Error);
}

}

}

}



public: bool ThumbnailCallback()

{

return false;

}

推荐答案


这篇关于帮助我解决错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-11 20:19