XML保存图像(其他?)文件
来源:互联网 发布:域内禁止软件运行 编辑:程序博客网 时间:2024/05/15 04:08
工程中引用System.Runtime.Serialization.Formatters.Soap
using namespace System::IO;
using namespace System::Runtime::Serialization::Formatters::Soap;
//SoapFormatter类 以 SOAP 格式将对象或整个连接对象的图形序列化和反序列化。
//保存为XML文件
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
String^ FileName;
FileStream^ OutFileStream;
if(this->pictureBox1->Image == nullptr)
return;
if(this->saveFileDialog1->ShowDialog() != System::Windows::Forms::DialogResult::OK)
return;
try{
FileName = this->saveFileDialog1->FileName;
OutFileStream = gcnew FileStream(FileName, FileMode::Create, FileAccess::Write, FileShare::None);
SoapFormatter^ MySoap = gcnew SoapFormatter();
MySoap->Serialize(OutFileStream, this->pictureBox1->Image);
OutFileStream->Close();
this->pictureBox1->Image = nullptr;
MessageBox::Show("success", "", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
catch(Exception^ eee){
MessageBox::Show(eee->Message, "", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
}
//显示XML图像文件
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if(this->openFileDialog2->ShowDialog() != System::Windows::Forms::DialogResult::OK)
return;
String^ FileName;
Stream^ MyStream;
SoapFormatter^ MySoap;
try{
FileName = this->openFileDialog2->FileName;
MyStream = gcnew FileStream(FileName, FileMode::Open, FileAccess::Read, FileShare::None);
MySoap = gcnew SoapFormatter();
this->pictureBox1->Image = (Bitmap^)(MySoap->Deserialize(MyStream));
MyStream->Close();
}
catch(Exception^ eee){
MessageBox::Show(eee->Message, "", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
}
- XML保存图像(其他?)文件
- 图像保存到XML文件和从XML中取出图像显示
- 图像保存到XML文件和从XML中取出图像显示
- xml解析(读取xml,保存文件到xml)
- 保存为XML文件
- Xml文件保存聊天记录
- XML文件读取、保存
- Xml文件的保存
- Barcode Professional for ASP.NET使用教程:条码图像保存到数据库或者XML文件
- 如何在web.xml文件中引入其他的xml文件(拆分web.xml)
- 如何在web.xml文件中引入其他的xml文件(拆分web.xml)
- 保存图片到XML文件
- java XML文件的保存
- 15 保存 解析 xml文件
- xml+xsd文件保存配置文件
- .net读取图像并保存为文件
- 保存HBITMAP图像到文件中
- html5 canvas图像保存为图片文件
- Navicat ?MySQL
- 对brew接口的一些理解
- Scene Management --- scene graph
- Professional C# 2008
- ETL学习笔记之四:开源项目 Kettle
- XML保存图像(其他?)文件
- Building Embedded Linux Systems
- 贴个工作管理界面
- VC下Debug 和Release 区别
- MySQL (4th Edition)
- Sams Teach Yourself ASP.NET Ajax in 24 Hours
- JAVA面试题解惑系列(七)——日期和时间的处理
- 网站用户单点登录系统解决方案
- 认识ASP