[問題] GDI+ 泛型錯誤?
本來的迴圈,可以不會出錯
foreach (PictureBox p_pb in flowLayoutPanel1.Controls)
{
byte[] buf;
MemoryStream ms = new MemoryStream();
p_pb.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
buf = ms.GetBuffer();
l_cp.產品編號 = lv_strGetMaxPrID
l_cp.照片 = buf;
ClsPicturesFactory l_cpifactory = new ClsPicturesFactory();
l_cpifactory.create(l_cp);
}
改用WPF的控制項,就會出現GDI+ 泛型錯誤
foreach (ElementHost p_eh in flowLayoutPanel1.Controls)
{
byte[] buf;
PictureBox p = new PictureBox();
var source =
((System.Windows.Controls.Image)((UserControl1)p_eh.Child).FindName("Image2"))
.Source;
p.Load(source.ToString());
MemoryStream ms = new MemoryStream();
p.Image.Save(ms,System.Drawing.Imaging.ImageFormat.Bmp);//這行會出錯
buf = ms.GetBuffer();
l_cp.產品編號 = lv_strGetMaxPrID;
l_cp.照片 = buf;
ClsPicturesFactory l_cpifactory = new ClsPicturesFactory();
l_cpifactory.create(l_cp);
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.9.209
※ 編輯: ONLYSMART 來自: 114.32.9.209 (06/07 18:09)
→
06/07 18:36, , 1F
06/07 18:36, 1F
→
06/07 18:36, , 2F
06/07 18:36, 2F
→
06/07 18:36, , 3F
06/07 18:36, 3F
大大!請問要則麼改?那個是檔案路徑沒錯!監看式有跑出來!
※ 編輯: ONLYSMART 來自: 114.32.9.209 (06/07 18:46)
※ 編輯: ONLYSMART 來自: 114.32.9.209 (06/07 19:42)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 3 篇):
0
3
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章