public async void AddProfileImage(ContactModel contactItem, RasterImage image, Stream imageStream) { string imageFileName = Path.GetFileNameWithoutExtension(contactItem.Picture).Replace("image_", ""); string filePath = Path.Combine(HomePage.PROFILE_PICS_DIR, $"profile_{imageFileName}.jpeg"); if (imageStream != null) { await DependencyService.Get <IPictureSaver>().SaveImage(imageStream, filePath, PictureSaveResolution.Low, false); } else if (image != null) { LeadSize size = ImageSizeHelper.GetImageSize(image.Width, image.Height, PictureSaveResolution.Low); ResizeInterpolateCommand resizeInterpolateCommand = new ResizeInterpolateCommand(size.Width, size.Height, ResizeInterpolateCommandType.Resample); resizeInterpolateCommand.Run(image); using (var codecs = new RasterCodecs()) { codecs.Save(image, filePath, RasterImageFormat.Jpeg, 0); } } contactItem.ProfileImage = filePath; Device.BeginInvokeOnMainThread(() => profileImageView.Source = filePath); HomePage.Instance.SaveContactList(); }
private void _ImageList_Paint(object sender, ImageViewerRenderEventArgs e) { // Draw the letter R on each recognized page LeadSize itemImageSize = _ImageList.ItemSize; Graphics g = e.PaintEventArgs.Graphics; using (Brush textBrush = new SolidBrush(Color.FromArgb(128, Color.Black))) { foreach (ImageViewerItem item in _ImageList.Items) { bool isPageRecognized = false; if (item.Tag != null) { isPageRecognized = (bool)item.Tag; } if (isPageRecognized) { LeadRectD itemRect = _ImageList.GetItemBounds(item, ImageViewerItemPart.Image); var transform = _ImageList.GetItemImageTransform(item); itemRect.X = transform.OffsetX; itemRect.Y = transform.OffsetY; SizeF textSize = g.MeasureString("R", _ImageList.Font); RectangleF textRect = new RectangleF((float)itemRect.X + 2, (float)itemRect.Y + 2, textSize.Width, textSize.Height); g.FillRectangle(textBrush, textRect); g.DrawString("R", _ImageList.Font, Brushes.White, textRect.Location); } } } }
public async void AddBackImage(ContactModel contactItem, RasterImage backImage, Stream imageStream) { string imageFileName = Path.GetFileNameWithoutExtension(contactItem.Picture).Replace("image_", ""); string backImagePath = Path.Combine(HomePage.APP_DIR, $"back_{imageFileName}.jpeg"); if (imageStream != null) { await DependencyService.Get <IPictureSaver>().SaveImage(imageStream, backImagePath, PictureSaveResolution.Medium, false); } else if (backImage != null) { LeadSize size = ImageSizeHelper.GetImageSize(backImage.Width, backImage.Height, PictureSaveResolution.Medium); ResizeInterpolateCommand resizeInterpolateCommand = new ResizeInterpolateCommand(size.Width, size.Height, ResizeInterpolateCommandType.Resample); resizeInterpolateCommand.Run(backImage); using (var codecs = new RasterCodecs()) { codecs.Save(backImage, backImagePath, RasterImageFormat.Jpeg, 0); } } contactItem.BackImage = backImagePath; HomePage.Instance.SaveContactList(); SetBackImage(); }
void _rasterImageList_PostRender(object sender, Leadtools.Controls.ImageViewerRenderEventArgs e) { for (int i = 0; i < _rasterImageList.Items.Count; i++) { ImageViewerItem item = _rasterImageList.Items[i]; LeadRectD itemLeadRect = _rasterImageList.GetItemBounds(item, ImageViewerItemPart.Item); Rectangle itemRect = new Rectangle((int)itemLeadRect.X, (int)itemLeadRect.Y, (int)itemLeadRect.Width, (int)itemLeadRect.Height); LeadSize itemImageSize = _rasterImageList.GetItemImageSize(item, false); LeadRect imageRect = new LeadRect( itemRect.Left + (itemRect.Width - itemImageSize.Width) / 2, itemRect.Top + (itemRect.Height - itemImageSize.Height) / 2, itemImageSize.Width, itemImageSize.Height); itemLeadRect = ImageViewer.GetDestinationRectangle(item.Image.ImageWidth, item.Image.ImageHeight, imageRect, ControlSizeMode.None, ControlAlignment.Near, ControlAlignment.Near).ToLeadRectD(); var destRect = LeadRectD.Create(itemLeadRect.X, itemLeadRect.Y, itemLeadRect.Width * 720.0 / 96.0, itemLeadRect.Height * 720.0 / 96.0); destRect.X = 0.0; destRect.Y = 0.0; //Get the graphic object from the item's image to draw (burn) annotations on it. Leadtools.Drawing.RasterImageGdiPlusGraphicsContainer GdiPlusGraphicsContainer = new RasterImageGdiPlusGraphicsContainer(item.Image); Graphics g = GdiPlusGraphicsContainer.Graphics; // Use anti-aliasing g.SmoothingMode = SmoothingMode.AntiAlias; // Now draw the annotation s on this rectangle if (_automationManager != null && _automation.Containers.Count > 0 && _automation.Containers.Count > i) { AnnContainer container = _automation.Containers[i]; //Clear the old painting g.Clear(Color.White); //Burn the current annotations to the image list item if (container != null) { AnnWinFormsRenderingEngine engine = new AnnWinFormsRenderingEngine(); engine.Resources = _automationManager.Resources; // Save its visible state and set it to true (it is false if viewer is in single mode) bool containerIsVisible = container.IsVisible; container.IsVisible = true; engine.Attach(container, g); engine.BurnToRectWithDpi(destRect, 96, 96, 96, 96); engine.Detach(); if (container.IsVisible != containerIsVisible) { container.IsVisible = containerIsVisible; } } } } }
/// <summary> /// Resize the MagnifyGlass height /// </summary> private void _miMagnifyGlassResizeHeight_Click(object sender, System.EventArgs e) { ValueDialog dlg = new ValueDialog(ValueDialog.TypeConstants.Height); dlg.Value = _size.Height; if (dlg.ShowDialog(this) == DialogResult.OK) { _size = new LeadSize(_size.Width, dlg.Value); UpdateMyControls(); } }
public LeadSize SizeToPixels(LeadSize value) { if (value.IsEmpty) { return(LeadSize.Empty); } var resolution = this.Pages.DefaultResolution; return(LeadSize.Create(DocumentToPixels(resolution, value.Width), DocumentToPixels(resolution, value.Height))); }
/// <summary> /// Change the Round Rectangle Ellipse Size /// </summary> private void _miMagnifyGlassRoundRectangleEllipseSize_Click(object sender, System.EventArgs e) { RoundRectSizeDialog dlg = new RoundRectSizeDialog(_roundRectangleEllipseSize.Width, _roundRectangleEllipseSize.Height, _size.Width, _size.Height); if (dlg.ShowDialog(this) == DialogResult.OK) { _roundRectangleEllipseSize = new LeadSize(dlg.RoundRectEllipseSize.Width, dlg.RoundRectEllipseSize.Height); UpdateMyControls(); } }
private static RasterImage CreateTextFooter(LeadSize size, string tag) { var bpp = 24; var byteOrder = RasterByteOrder.Bgr; var viewPerspective = RasterViewPerspective.TopLeft; var image = new RasterImage(RasterMemoryFlags.Conventional, size.Width, size.Height, bpp, byteOrder, viewPerspective, null, null, 0); var fill = new FillCommand(RasterColor.FromKnownColor(RasterKnownColor.White)); fill.Run(image); using (var graphics = RasterImagePainter.CreateGraphics(image)) { using (var brush = new SolidBrush(Color.Black)) { using (var font = new Font(FontFamily.GenericSansSerif, size.Width / 128)) { var pos = new PointF(0, 0); { SizeF stringSize = new SizeF(); stringSize = graphics.Graphics.MeasureString(tag, font); float scaleX = (float)size.Width / stringSize.Width; float scaleY = (float)size.Height / stringSize.Height; scaleX = Math.Min(1f, scaleX); scaleY = Math.Min(1f, scaleY); graphics.Graphics.ScaleTransform(scaleX, scaleY); if (size.Height > (int)stringSize.Height) { size.Height = (int)stringSize.Height; } } graphics.Graphics.DrawString(tag, font, Brushes.Black, new PointF(0, 0)); } } } if (size.Height < image.Height) { var crop = new CropCommand(LeadRect.FromLTRB(0, 0, size.Width, size.Height)); crop.Run(image); } return(image); }
private RasterImage AddTextFooter(RasterImage image, string tag, int footerMaxHeight) { LeadRect bounds = LeadRect.Create(0, 0, image.Width, image.Height); using (var imageTag = CreateTextFooter(LeadSize.Create(bounds.Width, footerMaxHeight), tag)) { bounds.Height += imageTag.Height; var bpp = 24; var byteOrder = RasterByteOrder.Bgr; var viewPerspective = RasterViewPerspective.TopLeft; if (image.ViewPerspective != viewPerspective) { image.ChangeViewPerspective(viewPerspective); } if (image.BitsPerPixel != bpp || image.Order != byteOrder) { var colorResCommand = new ColorResolutionCommand( ColorResolutionCommandMode.InPlace, bpp, byteOrder, RasterDitheringMethod.None, ColorResolutionCommandPaletteFlags.Optimized, null); colorResCommand.Run(image); } RasterImage imageResult = new RasterImage(RasterMemoryFlags.Conventional, bounds.Width, bounds.Height, bpp, byteOrder, viewPerspective, null, null, 0); { var combine = new CombineFastCommand(imageResult, bounds, LeadPoint.Create(0, 0), CombineFastCommandFlags.SourceCopy); combine.Run(image); } { var combine = new CombineFastCommand(imageResult, LeadRect.Create(bounds.X, image.Height, bounds.Width, bounds.Height - image.Height), LeadPoint.Create(0, 0), CombineFastCommandFlags.SourceCopy); combine.Run(imageTag); } return(imageResult); } }
/// <summary> /// Populate the control with thumbnails of the pages in the image /// </summary> public void SetDocument(RasterImage image) { _rasterImageList.BeginUpdate(); _rasterImageList.Items.Clear(); // Only add the thumbnails if the image has more than 1 page if (image != null && image.PageCount > 1) { image.DisableEvents(); int originalImagePageNumber = image.Page; try { LeadSize thumbSize = _rasterImageList.ItemSize; for (int page = 1; page <= image.PageCount; page++) { image.Page = page; RasterImage thumbnailImage = image.CreateThumbnail(thumbSize.Width, thumbSize.Height, 24, RasterViewPerspective.TopLeft, RasterSizeFlags.Resample); ImageViewerItem item = new ImageViewerItem(); item.Image = thumbnailImage; item.PageNumber = 1; item.Text = DemosGlobalization.GetResxString(GetType(), "Resx_Page") + page.ToString(); if (page == originalImagePageNumber) { item.IsSelected = true; } _rasterImageList.Items.Insert(page - 1, item); } } finally { image.Page = originalImagePageNumber; image.EnableEvents(); } } _rasterImageList.EndUpdate(); }
private void LoadPagesWithVirtualizer(string imageFileName, int pageCount, bool useSVG) { // Load the pages using a virtualizer // Note that the code below will get the width and height for each page indvidually // This is important because some file formats such as PDF, DOCX and TIFF supports pages // with different sizes. // If this behavior is not desired, then the code can be optimized by only obtaining the size // of the first page and re-using it for all items // First thing, we need to add empty items that are the same size as each page for (var pageNumber = 1; pageNumber <= pageCount; pageNumber++) { // This page size in pixels LeadSize pagePixelSize; LeadSizeD resolution; using (var imageInfo = _rasterCodecs.GetInformation(imageFileName, false, pageNumber)) { pagePixelSize = new LeadSize(imageInfo.Width, imageInfo.Height); resolution = new LeadSizeD(imageInfo.XResolution, imageInfo.YResolution); } // Set up the item with the size and resolution var item = new ImageViewerItem { ImageSize = pagePixelSize, Resolution = resolution }; // Add it to the viewer _imageViewer.Items.Add(item); } // All the items are added and ready, create a new virtualizer and use it var virtualizer = new MyImageViewerVirtualizer(imageFileName, _rasterCodecs, useSVG); _imageViewer.Virtualizer = virtualizer; }
private void MainForm_Load(object sender, System.EventArgs e) { // setup our caption Messager.Caption = "LEADTOOLS for .NET C# MagnifyGlass Demo"; Text = Messager.Caption; // initialize the _viewer object _viewer = new ImageViewer(); // Add the MagnifyGlass InteractiveMode _viewer.InteractiveModes.Add(magGlass); RasterPaintProperties paintProperties = RasterPaintProperties.Default; paintProperties.PaintDisplayMode |= RasterPaintDisplayModeFlags.Bicubic | RasterPaintDisplayModeFlags.ScaleToGray; paintProperties.PaintEngine = RasterPaintEngine.GdiPlus; _viewer.PaintProperties = paintProperties; _viewer.Dock = DockStyle.Fill; _viewer.BackColor = Color.DarkGray; Controls.Add(_viewer); _viewer.BringToFront(); // initialize the codecs object _codecs = new RasterCodecs(); // initialize the other variables _borderColor = Color.Red; _borderWidth = 2; _crosshair = ImageViewerSpyGlassCrosshair.Fine; _crosshairColor = Color.Green; _crosshairWidth = 1; _roundRectangleEllipseSize = new LeadSize(20, 20); _scaleFactor = 2; _shape = ImageViewerSpyGlassShape.Rectangle; _size = new LeadSize(150, 150); UpdateMyControls(); }
private void FillImageList(RasterImage image) { using (RasterCodecs codecs = new RasterCodecs()) { ImageListControl.Items.Clear(); for (int index = 1; index <= image.PageCount; index++) { image.Page = index; // Create the item of the image list ImageViewerItem item = new ImageViewerItem(); item.Size = LeadSize.Create(120, 120); item.Text = "Page: " + (index - 1).ToString(); item.Image = image.Clone(); item.Tag = index; // Add the item to the image list ImageListControl.Items.Add(item); } ImageListControl.Items[0].IsSelected = true; _viewer.Image = ImageListControl.Items[0].Image; } }
private static LEADDocument Parse(dynamic result) { var document = new LEADDocument(); document.DocumentId = result.values.documentId; document.Name = result.values.name; document.FileLength = result.values.fileLength; document.MimeType = result.values.mimeType; document.UserId = result.values.userId; document.DocumentType = result.values.documentType; document.IsEncrypted = result.values.isEncrypted; document.IsDecrypted = result.values.isDecrypted; document.Format = (RasterImageFormat)result.values.format; document.Uri = result.values.uri; document.IsReadOnly = result.values.isReadOnly; document.IsStructureSupported = result.values.isStructureSupported; // Metadata var metadata = result.metadata.ToObject <Dictionary <string, string> >(); document.Metadata = new Dictionary <string, string>(); foreach (var item in metadata) { document.Metadata.Add(item.Key, item.Value); } // Structure if (document.IsStructureSupported) { document.Structure = new DocumentStructure(); document.Structure.IsParsed = result.values.isStructureParsed; } // Images document.Images = new DocumentImages(); document.Images.IsSvgSupported = result.values.isSvgSupported; document.Images.IsSvgViewingPreferred = result.values.isSvgViewingPreferred; document.Images.IsResolutionsSupported = result.values.isResolutionsSupported; document.Images.DefaultBitsPerPixel = result.values.defaultBitsPerPixel; document.Images.MaximumImagePixelSize = result.values.maximumImagePixelSize; document.Images.ThumbnailPixelSize = LeadSize.FromJSON(result.values.thumbnailPixelSize.ToString(Formatting.None)); document.Images.UnembedSvgImages = result.values.unembedSvgImages; // Text document.Text = new DocumentText(); document.Text.TextExtractionMode = (DocumentTextExtractionMode)result.values.textExtractionMode; document.Text.ImagesRecognitionMode = (DocumentTextImagesRecognitionMode)result.values.imagesRecognitionMode; document.Text.AutoParseLinks = result.values.autoParseLinks; document.Text.ParseBookmarks = result.values.parseBookmarks; document.Text.ParsePageLinks = result.values.parsePageLinks; // History document.History = new DocumentHistory(); document.History.AutoUpdateHistory = result.values.autoUpdateHistory; // Annotations document.Annotations = new DocumentAnnotations(); var redactionOptions = new DocumentRedactionOptions(); redactionOptions.ViewOptions = new ViewRedactionOptions(); redactionOptions.ConvertOptions = new ConvertRedactionOptions(); document.Annotations.RedactionOptions = redactionOptions; if (result.values.redactionOptions != null) { if (result.values.redactionOptions.viewOptions != null) { document.Annotations.RedactionOptions.ViewOptions.Mode = result.values.redactionOptions.viewOptions.mode; document.Annotations.RedactionOptions.ViewOptions.ReplaceCharacter = result.values.redactionOptions.viewOptions.replaceCharacter; document.Annotations.RedactionOptions.ViewOptions.IntersectionPercentage = result.values.redactionOptions.viewOptions.intersectionPercentage; } if (result.values.redactionOptions.convertOptions != null) { document.Annotations.RedactionOptions.ConvertOptions.Mode = result.values.redactionOptions.convertOptions.mode; document.Annotations.RedactionOptions.ConvertOptions.ReplaceCharacter = result.values.redactionOptions.convertOptions.replaceCharacter; document.Annotations.RedactionOptions.ConvertOptions.IntersectionPercentage = result.values.redactionOptions.convertOptions.intersectionPercentage; } } // View commands if (result.values.viewOptions != null) { document.ViewOptions = new DocumentViewOptions(); document.ViewOptions.ViewLayout = result.values.viewOptions.viewLayout; document.ViewOptions.AnnotationsUserMode = result.values.viewOptions.annotationsUserMode; document.ViewOptions.PageNumber = result.values.viewOptions.pageNumber; document.ViewOptions.ViewZoomPercent = result.values.viewOptions.viewZoomPercent; document.ViewOptions.ViewScrollOffset = LeadPoint.FromJSON(result.values.viewOptions.viewScrollOffset.ToString(Formatting.None)); document.ViewOptions.ViewSizeMode = result.values.viewOptions.viewSizeMode; document.ViewOptions.ViewItemType = result.values.viewOptions.viewItemType; document.ViewOptions.LoadAnnotations = result.values.viewOptions.loadAnnotations; document.ViewOptions.LoadThumbnails = result.values.viewOptions.loadThumbnails; document.ViewOptions.LoadBookmarks = result.values.viewOptions.loadBookmarks; var commandTokens = result.values.viewOptions.viewCommands as IEnumerable <dynamic>; if (commandTokens != null) { foreach (dynamic commandToken in commandTokens) { var command = new DocumentViewCommand(); command.Command = commandToken.command; command.Parameters = commandToken.parameters; document.ViewOptions.ViewCommands.Add(command); } } } // Documents document.Documents = null; var documentTokens = result.documents as IEnumerable <dynamic>; if (documentTokens != null) { foreach (dynamic documentToken in documentTokens) { string childDocumentId = documentToken.values.documentId; if (document.Documents == null) { document.Documents = new DocumentDocuments(); } document.Documents.Add(childDocumentId); } } // Pages document.Pages = new DocumentPages(); document.Pages.OriginalFirstPageNumber = result.values.originalFirstPageNumber; document.Pages.OriginalLastPageNumber = result.values.originalLastPageNumber; document.Pages.OriginalPageCount = result.values.originalPageCount; document.Pages.DefaultResolution = result.values.defaultResolution; document.Pages.DefaultPageSize = LeadSize.FromJSON(result.values.defaultPageSize.ToString(Formatting.None)); var pageTokens = result.pages as IEnumerable <dynamic>; if (pageTokens != null) { foreach (dynamic pageToken in pageTokens) { DocumentPage page = new DocumentPage(); page.DocumentId = pageToken.values.documentId; page.PageNumber = pageToken.values.pageNumber; page.Size = LeadSize.FromJSON(pageToken.values.size.ToString(Formatting.None)); page.Resolution = pageToken.values.resolution; page.OriginalPageNumber = pageToken.values.originalPageNumber; page.IsDeleted = pageToken.values.isDeleted; page.IsImageModified = pageToken.values.isImageModified; page.IsSvgBackImageModified = pageToken.values.isSvgBackImageModified; page.IsThumbnailModified = pageToken.values.isThumbnailModified; page.IsSvgModified = pageToken.values.isSvgModified; page.IsTextModified = pageToken.values.isTextModified; page.IsAnnotationsModified = pageToken.values.isAnnotationsModified; page.IsLinksModified = pageToken.values.isLinksModified; //page.Links; page.IsViewPerspectiveModified = pageToken.values.isViewPerspectiveModified; page.ViewPerspective = (RasterViewPerspective)pageToken.values.viewPerspective; document.Pages.Add(page); } } return(document); }
public LeadSize SizeToDocument(LeadSize value) { var resolution = this.Pages.DefaultResolution; return(LeadSize.Create(PixelsToDocument(resolution, (int)value.Width), PixelsToDocument(resolution, (int)value.Height))); }
public static Size Convert(LeadSize size) { return(new Size(size.Width, size.Height)); }
public static void SaveDocument(LEADDocument document, ObservableCollection <DocumentItemData> documentsCollection, OcrOutputFormat format = OcrOutputFormat.None, int replaceItemAtIndex = -1, bool autoSerializeDocuments = true) { string thumbnailPath = Path.Combine(CacheDirectory, document.DocumentId, $"thumbnail.jpeg"); // Create new document item data DateTime currentDatetime = DateTime.Now; if (string.IsNullOrWhiteSpace(document.Name)) { if (replaceItemAtIndex == -1) // we are adding new document and not replacing existing one, so use the old document name { document.Name = FindUniqueDocumentName(documentsCollection); } else { document.Name = documentsCollection[replaceItemAtIndex].Title; } } string annotationsFilePath = Path.Combine(ApplicationDirectory, "Documents", $"{document.Name}.xml"); DocumentItemData newDocumentItemData = new DocumentItemData(); newDocumentItemData.DocumentId = document.DocumentId; newDocumentItemData.DocumentThumbnailPath = thumbnailPath; newDocumentItemData.AnnotationsFilePath = annotationsFilePath; newDocumentItemData.Title = document.Name; newDocumentItemData.Date = currentDatetime; newDocumentItemData.DocumentFormat = format; if (Device.RuntimePlatform == Device.iOS) { // Save the original file path that was loaded from gallery, so we can delete it later when we convert this document in // order to save space since we won't need this file anymore. // only do this for the newly created documents and not the already converted ones. if (format == OcrOutputFormat.None) { newDocumentItemData.DocumentFiles = GetDocumentSourceFiles(document); } } IEnumerable <DocumentItemData> items = documentsCollection.Where(x => x.DocumentId.Equals(document.DocumentId)); if ((items != null && items.Count() > 0) || replaceItemAtIndex != -1) { // Document already exist, so just update it int index = (replaceItemAtIndex != -1) ? replaceItemAtIndex : documentsCollection.IndexOf(items.ElementAt(0)); documentsCollection.Insert(index, newDocumentItemData); documentsCollection.RemoveAt(index + 1); } else { documentsCollection.Add(newDocumentItemData); } if (autoSerializeDocuments) { SerializeDocuments(documentsCollection); } document.SaveToCache(); if (document.Pages != null && document.Pages.Count > 0) { using (var codecs = new RasterCodecs()) { try { LeadSize thumbnailSize = LeadSize.Create((int)(document.Images.ThumbnailPixelSize.Width * 1.5), (int)(document.Images.ThumbnailPixelSize.Height * 1.5)); using (var rasterImage = document.Pages[0].GetImage()) { var thumbnailImage = rasterImage.CreateThumbnail(thumbnailSize.Width, thumbnailSize.Height, 32, RasterViewPerspective.TopLeft, RasterSizeFlags.Bicubic); if (thumbnailImage == null) { thumbnailImage = document.Pages[0].GetThumbnailImage(); } codecs.Save(thumbnailImage, thumbnailPath, RasterImageFormat.Jpeg, 0); } } catch (Exception ex) { Console.WriteLine(ex.Message); codecs.Save(document.Pages[0].GetThumbnailImage(), thumbnailPath, RasterImageFormat.Jpeg, 0); } } } }
private void InitClass( ) { _viewer = new ImageViewer(); _viewer.Dock = DockStyle.Fill; _viewer.BorderStyle = BorderStyle.None; _pnlViewer.Controls.Add(_viewer); _viewer.BringToFront(); _viewer.AllowDrop = true; _viewer.AutoDisposeImages = false; // Create a new RasterImageList control. ImageViewerVerticalViewLayout viewLayout = new Leadtools.Controls.ImageViewerVerticalViewLayout() { Columns = 1 }; ImageListControl = new ImageViewer(viewLayout); Size = new Size(200, 200); ImageListControl.Bounds = new Rectangle(new Point(0, 0), Size); ImageListControl.SelectedItemBorderColor = Color.Red; ImageListControl.SelectedItemBackgroundColor = Color.LightBlue; ImageListControl.BackColor = Color.LightGray; ImageListControl.BorderStyle = BorderStyle.FixedSingle; ImageListControl.ImageBorderThickness = 1; ImageListControl.ImageHorizontalAlignment = ControlAlignment.Far; ImageListControl.ImageVerticalAlignment = ControlAlignment.Center; ImageListControl.ItemBackgroundColor = Color.LightGray; ImageListControl.ItemBorderThickness = 0; ImageListControl.ItemPadding = new Padding(20); ImageListControl.ItemTextColor = Color.Black; ImageListControl.ItemSize = LeadSize.Create(60, 80); ImageListControl.ItemSizeMode = ControlSizeMode.Fit; ImageListControl.Dock = DockStyle.Fill; RasterPaintProperties paintProperties = ImageListControl.PaintProperties; paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic; ImageListControl.PaintProperties = paintProperties; ImageListControl.Height = _viewer.Height; ImageListControl.TextHorizontalAlignment = ControlAlignment.Center; ImageListControl.TextVerticalAlignment = ControlAlignment.Center; ImageListControl.InteractiveModes.BeginUpdate(); ImageListControl.InteractiveModes.Add(new ImageViewerSelectItemsInteractiveMode() { SelectionMode = ImageViewerSelectionMode.Single }); ImageListControl.InteractiveModes.EndUpdate(); ImageListControl.SelectedItemsChanged += new EventHandler(ImageListControl_SelectedItemsChanged); ImageListControl.AutoDisposeImages = false; // Add the RasterImageList to the control collection. _pnlImageList.Controls.Add(ImageListControl); PlayingAnnimation = false; StopAnimation = false; LoopAnimation = false; ActiveList = ActiveImageLists.ColorList; ImagesList = new List <RasterImage>(); ColorList = new List <RasterImage>(); OpacityList = new List <RasterImage>(); PreOpacityList = new List <RasterImage>(); ((MainForm)MdiParent).ClearCheck(); ((MainForm)MdiParent).SetCheck(ActiveList); RenderHeight = DefaultViewerHeight; RenderWidth = DefaultViewerWidth; AnimationDelay = DefaultDelay; }