Leadtools.WinForms Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
AutoDeselectItems Property
See Also  Example
Leadtools.WinForms Namespace > RasterImageList Class : AutoDeselectItems Property




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

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Enables or disables de-selecting items when mouse button is clicked when selection mode is set to multi.")>
<CategoryAttribute("Behavior")>
Public Property AutoDeselectItems As Boolean
Visual Basic (Usage)Copy Code
Dim instance As RasterImageList
Dim value As Boolean
 
instance.AutoDeselectItems = value
 
value = instance.AutoDeselectItems
C# 
[DescriptionAttribute("Enables or disables de-selecting items when mouse button is clicked when selection mode is set to multi.")]
[CategoryAttribute("Behavior")]
public bool AutoDeselectItems {get; set;}
Managed Extensions for C++ 
[DescriptionAttribute("Enables or disables de-selecting items when mouse button is clicked when selection mode is set to multi.")]
[CategoryAttribute("Behavior")]
public: __property bool get_AutoDeselectItems();
public: __property void set_AutoDeselectItems( 
   bool value
);
C++/CLI 
[DescriptionAttribute("Enables or disables de-selecting items when mouse button is clicked when selection mode is set to multi.")]
[CategoryAttribute("Behavior")]
public:
property bool AutoDeselectItems {
   bool get();
   void set (bool value);
}

Return Value

true to enable de-selecting; false otherwise.

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.

Visual BasicCopy Code
Private Class MyForm6 : Inherits Form
   Public imageList As RasterImageList
   Private codecs As RasterCodecs
   Public Sub New()
      ' 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()

      RasterCodecs.Startup()
      codecs = New RasterCodecs()

      ' Create three items
      Dim imagesPath As String = "C:\program files\LEAD Technologies\LEADTOOLS 15\Images\"

      For i As Integer = 0 To 2
         ' Load the image
         Dim index As Integer = i + 1
         Dim imageFileName As String = imagesPath & "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 item
         If i = 0 Then
            item.Selected = True
         End If

         ' Add the item to the image list
         imageList.Items.Add(item)
      Next i

      RasterCodecs.Shutdown()

      ' Add the RasterImageList to the control collection.
      Controls.Add(imageList)
   End Sub
End Class

Public Sub RasterImageList_AutoDeselectItems()
   Dim form As MyForm6 = 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()
End Sub
C#Copy Code
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(); 
 
      RasterCodecs.Startup(); 
      codecs = new RasterCodecs(); 
 
      // Create three items 
      string imagesPath = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\"; 
 
      for(int i = 0; i < 3; i++) 
      { 
         // Load the image 
         int index = i + 1; 
         string imageFileName = imagesPath + "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); 
      } 
 
      RasterCodecs.Shutdown(); 
 
      // 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(); 
}

Remarks

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

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also