Enables or disables de-selecting items when mouse button is clicked.
public bool AutoDeselectItems { get; set; } Public Property AutoDeselectItems As Boolean true to enable de-selecting; false otherwise.
This property is used only if SelectionMode is set to RasterImageListSelectionMode.Multi.
This example shows how to select (rubber band) and deselect multiple items with a mouse button. Run the sample, and select two or more items. Then click the mouse button to deselect all items.
using Leadtools.WinForms;using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;class MyForm6 : Form{public RasterImageList imageList;RasterCodecs codecs;public MyForm6(){// Set the size of the formSize = new Size(500, 200);// Create a new RasterImageList controlimageList = new RasterImageList();imageList.Dock = DockStyle.Fill;imageList.SelectionMode = RasterImageListSelectionMode.Single;imageList.Size = Size;Controls.Add(imageList);imageList.BringToFront();codecs = new RasterCodecs();// Create three itemsstring imagesPath = LEAD_VARS.ImagesDir;for (int i = 0; i < 3; i++){// Load the imageint index = i + 1;string imageFileName = Path.Combine(imagesPath, @"ImageProcessingDemo\Image" + index.ToString() + ".cmp");RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1);RasterImageListItem item = new RasterImageListItem(image, 1, "Item" + index.ToString());// Select the first itemif (i == 0)item.Selected = true;// Add the item to the image listimageList.Items.Add(item);}// Add the RasterImageList to the control collection.Controls.Add(imageList);}}public void RasterImageList_AutoDeselectItems(){MyForm6 form = new MyForm6();// Enable rubber band multi selectform.imageList.EnableRubberBandSelection = true;// Enable the AutoDeselectItemsform.imageList.AutoDeselectItems = true;form.imageList.SelectionMode = RasterImageListSelectionMode.Multi;form.Text = "Drag mouse to select two images. Then single-click to de-select.";form.ShowDialog();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports Leadtools.WinFormsImports LeadtoolsImports Leadtools.CodecsImports Leadtools.DrawingPrivate Class MyForm6 : Inherits FormPublic imageList As RasterImageListPrivate codecs As RasterCodecsPublic Sub New()' Set the size of the formSize = New Size(500, 200)' Create a new RasterImageList controlimageList = New RasterImageList()imageList.Dock = DockStyle.FillimageList.SelectionMode = RasterImageListSelectionMode.SingleimageList.Size = SizeControls.Add(imageList)imageList.BringToFront()codecs = New RasterCodecs()' Create three itemsDim imagesPath As String = LEAD_VARS.ImagesDirFor i As Integer = 0 To 2' Load the imageDim index As Integer = i + 1Dim imageFileName As String = Path.Combine(imagesPath, "ImageProcessingDemo\Image" & index.ToString() & ".cmp")Dim image As RasterImage = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)Dim item As RasterImageListItem = New RasterImageListItem(image, 1, "Item" & index.ToString())' Select the first itemIf i = 0 Thenitem.Selected = TrueEnd If' Add the item to the image listimageList.Items.Add(item)Next i' Add the RasterImageList to the control collection.Controls.Add(imageList)End SubEnd ClassPublic Sub RasterImageList_AutoDeselectItems()Dim form As MyForm6 = New MyForm6()' Enable rubber band multi selectform.imageList.EnableRubberBandSelection = True' Enable the AutoDeselectItemsform.imageList.AutoDeselectItems = Trueform.imageList.SelectionMode = RasterImageListSelectionMode.Multiform.Text = "Drag mouse to select two images. Then single-click to de-select."form.ShowDialog()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
