Как загрузить и просматреть изображения в ImageViewer с различными настройками рендеринга?
В этом разделе
ImageViewer использует настройки рендеринга из свойства
ImageViewer.ImageRenderingSettings для рендеринга изображения, если значение свойства
ImageViewer.ImageRenderingSettings НЕ равно null.
ImageViewer использует настройки рендеринга из свойства
VintasoftImage.RenderingSettings для рендеринга изображения, если значение свойства
ImageViewer.ImageRenderingSettings равно null.
Вот C#/VB.NET код, который демонстрирует, как загрузить 2 PDF документа с разными настройками рендеринга в
ImageViewer:
// disable management of rendering settings in ImageViewer
imageViewer1.ImageRenderingSettings = null;
// create temporary image collection
Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection();
// add all pages of the first PDF document to temporary image collection
images.Add("testFile1.pdf");
// for each image in temporary image collection
for (int i = 0; i < images.Count; i++)
// change rendering settings of image
images[i].RenderingSettings.Resolution = new Vintasoft.Imaging.Resolution(300, 300);
// add images from temporary image collection to the image viewer
imageViewer1.Images.AddRange(images.ToArray());
// clear temporary image collection
images.Clear();
// add all pages of the second PDF document to temporary image collection
images.Add("testFile2.pdf");
// for each image in temporary image collection
for (int i = 0; i < images.Count; i++)
// change rendering settings of image
images[i].RenderingSettings.Resolution = new Vintasoft.Imaging.Resolution(100, 100);
// add images from temporary image collection to the image viewer
imageViewer1.Images.AddRange(images.ToArray());
' disable management of rendering settings in ImageViewer
imageViewer1.ImageRenderingSettings = Nothing
' create temporary image collection
Dim images As New Vintasoft.Imaging.ImageCollection()
' add all pages of the first PDF document to temporary image collection
images.Add("testFile1.pdf")
' for each image in temporary image collection
For i As Integer = 0 To images.Count - 1
' change rendering settings of image
images(i).RenderingSettings.Resolution = New Vintasoft.Imaging.Resolution(300, 300)
Next
' add images from temporary image collection to the image viewer
imageViewer1.Images.AddRange(images.ToArray())
' clear temporary image collection
images.Clear()
' add all pages of the second PDF document to temporary image collection
images.Add("testFile2.pdf")
' for each image in temporary image collection
For i As Integer = 0 To images.Count - 1
' change rendering settings of image
images(i).RenderingSettings.Resolution = New Vintasoft.Imaging.Resolution(100, 100)
Next
' add images from temporary image collection to the image viewer
imageViewer1.Images.AddRange(images.ToArray())