我编写应该在控件Windows Forms Application
上显示图像的应用程序。PictureBox
要从DICOMDIR
文件中检索此图像,我使用fo-dicom
库(由本指南驱动):
....
private void MainForm_Load(object sender, EventArgs e)
{
ImageManager.SetImplementation(WinFormsImageManager.Instance);
}
....
// this function is just for example
// real function is bit complicated
private void ShowImage()
{
// Getting DICOM file, retrieving all info from it
// Getting dicomDataset instance
....
var id = dicomDataset.Get<string>(DicomTag.ReferencedFileID, -1);
var dicomImage = new DicomImage(id);
var bitmap = dicomImage.RenderImage().AsBitmap();
pictureBox.Image = bitmap ?? pictureBox.ErrorImage;
}
当图像检索一切正常。但maximize
我一MainForm
收到消息:System.ArgumentException
Parameter is not valid
看起来这是一个 .NET Framework 错误,但也许有办法通过控制方法来override
修复OnPaint()
它PictureBox
?
有没有人以前看到过这个错误?
提前致谢。
PS 在开发这个项目期间,我使用以下软件:
- 视窗 10 x64
- Visual Studio 2017 社区版
- .NET 框架 4.5.1
- fo-dicom 版本 3.0.2
编辑#1
Panel
与而不是相同的问题PictureBox
: