我正在为 Crowling 图像使用以下代码。
我正在删除已经存在的图像。
它正在工作,但是当我保存新图像时,它正在保存图像,但创建的文件时间显示与之前创建的文件时间相同。
谁能知道我该如何解决这个问题?
我的代码如下。
Image _Image = DownloadImage(ImageSrc);
if (_Image != null)
{
if (File.Exists(LargeImagePath + FileName))
{
File.Delete(LargeImagePath + FileName);
}
_Image.Save(LargeImagePath + FileName);
}
最佳答案
我不确定这是最好的解决方案,但您始终可以手动设置文件的创建日期:
File.SetCreationTime(LargeImagePath + FileName, DateTime.Now);
关于c# - .net Winforms 中的保存图像问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12299821/