久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 SaveFileDialog 后,在 Bitmap.Save() 的 GDI+ 處發生

A Generic error occurs at GDI+ at Bitmap.Save() after using SaveFileDialog(使用 SaveFileDialog 后,在 Bitmap.Save() 的 GDI+ 處發生一般錯誤)
本文介紹了使用 SaveFileDialog 后,在 Bitmap.Save() 的 GDI+ 處發生一般錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我使用以下代碼塊,并在 using 塊中添加了更多代碼:

I use the following code block with some more code inside the using block:

using (System.Drawing.Bitmap tempImg =
       (System.Drawing.Bitmap)tempObj.GetData(System.Windows.Forms.DataFormats.Bitmap))
{
    // ...
    tempImg.Save("..\..\testdata\tempImg.bmp", ImageFormat.Bmp);                            
    // ...
}

但我仍然收到錯誤:

GDI+ 出現一般錯誤

A Generic Error occured at GDI+

只有在我做了一些與 using 塊內的代碼無關的操作之后.在其他時候,這很有效.tempImg.bmp 也是一個臨時文件,所以我刪除了 using 塊本身中的 tempImg.bmp.

only after I make some action which is not related to the code inside the using block. In other times this works well. Also the tempImg.bmp is a temporary file, so I delete the tempImg.bmp within the using block itself.

由于 tempImg 在 using 里面并且它被處理了,我認為應該解決鎖定問題.

Since the tempImg is inside the using and this it's disposed, I think the locking problem should be solved.

有人可以讓我知道這段代碼中的錯誤是什么嗎?

Can someone please let me know what is the mistake in this code?

System.Drawing.ImageSystem.Drawing.Bitmap 作為 tempImg 的類型.

System.Drawing.Image to System.Drawing.Bitmap as the type of tempImg.

我已經確定只有在創建 SaveFileDialog 并且用戶單擊保存"后才會收到此錯誤.

I have identified I get this error only after SaveFileDialog is created and user clicks on 'Save'.

推薦答案

我終于可以找到我的代碼有什么問題了,我想在這里提一下,因為我認為它可能對某人有用....

Finally I could find what was wrong in my code and would like to mention it here as I think it may be useful to someone....

因為我在 tempImg.Save 中給出了一個相對路徑,在用戶點擊 SaveFileDialog 中的Save"后,tempImg.Save 的實際路徑變為:

As I have given a relative path in tempImg.Save, and after the user clicks 'Save' in SaveFileDialog, the actual path for tempImg.Save become :

SaveFileDialog指定的路徑+相對路徑

Path specified by SaveFileDialog + the relative path

自動.

因此,如果路徑不存在,則會發生此錯誤.

Thus if the path does not exist, this error occurs.

謝謝大家的回答.

這篇關于使用 SaveFileDialog 后,在 Bitmap.Save() 的 GDI+ 處發生一般錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Right-click on a Listbox in a Silverlight 4 app(右鍵單擊 Silverlight 4 應用程序中的列表框)
WPF c# webbrowser scrolls over top menu(WPF c# webbrowser 在頂部菜單上滾動)
C# Console app - How do I make an interactive menu?(C# 控制臺應用程序 - 如何制作交互式菜單?)
How to avoid duplicate form creation in .NET Windows Forms?(如何避免在 .NET Windows Forms 中創建重復的表單?)
UI Automation Control Desktop Application and Click on Menu Strip(UI自動化控制桌面應用程序并單擊菜單條)
Removing thin border around the menuitems(刪除菜單項周圍的細邊框)
主站蜘蛛池模板: 艳妇臀荡乳欲伦交换h漫 | 欧美日韩一区二区在线 | 欧美爱爱网 | 青青草视频网站 | 欧美日韩网站 | 午夜专区 | 日韩欧美视频一区 | 精品视频在线观看免费 | 日韩中文视频 | 亚洲精品一区二区三区精华液 | 成人高潮片免费网站 | 成人在线网址 | 亚洲免费观看视频 | 欧美日韩国产在线播放 | 男人午夜影院 | 亚洲天堂中文字幕 | 综合色在线 | 欧美伦理一区二区 | 美女一级片| 久久国产一区二区 | 国产在线h | 欧美一级黄色录像 | 日韩一区在线播放 | 国产精品久久久久久久午夜 | 国产三级在线观看视频 | a级片网站| 亚洲精品在 | 亚洲精品国产精品国自产观看 | 久久国产精品免费视频 | 午夜综合网 | 四虎四虎 | 性欧美bbw| 日韩欧美网站 | 触手繁殖の地狱3d啪啪 | 日本a v在线播放 | 蜜桃av一区二区三区 | 黄色片视频免费 | 毛片aaa| 欧美日韩色 | 成人黄色免费视频 | 国产高潮在线 |