silverlight开发一个涂鸦板问题 用silverlight开发了一个涂鸦板,现在可以将涂鸦板生成一个.png的图片.因为要将图片传到服务器上去,所以需要指定图片名字.请问如何在不打开系统对话框的情况下,设置.png文件的名字,然后上传到服务器!!!坐等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 WriteableBitmap _bitmap = new WriteableBitmap(iPresenter, null); //生成预览 // this.showIP.Source = _bitmap; SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "PNG Files (*.png)|*.png|All Files (*.*)|*.*"; sfd.DefaultExt = ".png"; sfd.FilterIndex = 1; //sfd.SafeFileName = ""; if ((bool)sfd.ShowDialog()) { using (Stream fs = sfd.OpenFile()) { IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); int width = _bitmap.PixelWidth; int height = _bitmap.PixelHeight; EditableImage ei = new EditableImage(width, height); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { int pixel = _bitmap.Pixels[(i * width) + j]; ei.SetPixel(j, i, (byte)((pixel >> 16) & 0xFF), (byte)((pixel >> 8) & 0xFF), (byte)(pixel & 0xFF), (byte)((pixel >> 24) & 0xFF) ); } } //获取流 Stream png = ei.GetStream(); int len = (int)png.Length; byte[] bytes = new byte[len]; png.Read(bytes, 0, len); fs.Write(bytes, 0, len); string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); //string FileName = Environment; MessageBox.Show("图片保存成功!"); }}这里是网上可以找到的保存代码!!! http://www.silverlightchina.net/html/tips/2011/0727/9314.htmlhttp://tech.ddvip.com/2008-11/122688969492844_2.html SOS..SOS..SOS..SOS..SOS..SOS.. asp.net是如何提交表单信息的 Jquery 有类似于像EXTJS 那样的后台吗? 能不能弹出个对话框,让网页暂停一下 asp.net 能调用网站外部文件夹吗? 如何获得Web.Config文件的路径 请问大家如何修改保存在web.config中的用户名和密码? SqlDataSource里面的selectCommand语句 Fckeditor 2.3.1问题:上传图象中 浏览服务器 按钮弹出的窗体不能操作? 程序编译后出现乱码,求解。在线等 asp.net 软件著作权登记 js 在浏览器上兼容问题 asp.ne页面中,刷新页面提交数据怎么解决
//生成预览
// this.showIP.Source = _bitmap;
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "PNG Files (*.png)|*.png|All Files (*.*)|*.*";
sfd.DefaultExt = ".png";
sfd.FilterIndex = 1;
//sfd.SafeFileName = "";
if ((bool)sfd.ShowDialog())
{ using (Stream fs = sfd.OpenFile())
{
IsolatedStorageFile store =
IsolatedStorageFile.GetUserStoreForApplication();
int width = _bitmap.PixelWidth;
int height = _bitmap.PixelHeight;
EditableImage ei = new EditableImage(width, height);
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
int pixel = _bitmap.Pixels[(i * width) + j];
ei.SetPixel(j, i,
(byte)((pixel >> 16) & 0xFF),
(byte)((pixel >> 8) & 0xFF),
(byte)(pixel & 0xFF),
(byte)((pixel >> 24) & 0xFF)
);
}
}
//获取流
Stream png = ei.GetStream();
int len = (int)png.Length;
byte[] bytes = new byte[len];
png.Read(bytes, 0, len);
fs.Write(bytes, 0, len);
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
//string FileName = Environment;
MessageBox.Show("图片保存成功!");
}
}
这里是网上可以找到的保存代码!!!
http://tech.ddvip.com/2008-11/122688969492844_2.html