AutoDeselectItems Property

Summary

Enables or disables de-selecting items when mouse button is clicked.

Syntax

C#
C++/CLI
C++
public bool AutoDeselectItems { get; set; } 
public: 
property bool AutoDeselectItems { 
   bool get(); 
   void set (    bool ); 
} 
public:  
   property bool AutoDeselectItems 
   { 
      bool get() 
      void set(bool value) 
   } 

Property Value

true to enable de-selecting; false otherwise.

Remarks

This property is used only if SelectionMode is set to RasterImageListSelectionMode.Multi.

Example

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.

C#
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 form 
      Size = new Size(500, 200); 
 
      // Create a new RasterImageList control 
      imageList = new RasterImageList(); 
      imageList.Dock = DockStyle.Fill; 
      imageList.SelectionMode = RasterImageListSelectionMode.Single; 
      imageList.Size = Size; 
      Controls.Add(imageList); 
      imageList.BringToFront(); 
 
      codecs = new RasterCodecs(); 
 
      // Create three items 
      string imagesPath = LEAD_VARS.ImagesDir; 
 
      for (int i = 0; i < 3; i++) 
      { 
         // Load the image 
         int 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 item 
         if (i == 0) 
            item.Selected = true; 
 
         // Add the item to the image list 
         imageList.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 select 
   form.imageList.EnableRubberBandSelection = true; 
 
   // Enable the AutoDeselectItems 
   form.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:\LEADTOOLS22\Resources\Images"; 
} 

Requirements

Target Platforms

See Also

Reference

RasterImageList Class

RasterImageList Members

Help Version 22.0.2023.2.9
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.WinForms Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.