LEADTOOLS Windows Forms (Leadtools.WinForms assembly)
LEAD Technologies, Inc

AutoDeselectItems Property (RasterImageList)

Example 





Enables or disables de-selecting items when mouse button is clicked.
Syntax
[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;}
'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
'Usage
 
Dim instance As RasterImageList
Dim value As Boolean
 
instance.AutoDeselectItems = value
 
value = instance.AutoDeselectItems
[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;}
DescriptionAttribute("Enables or disables de-selecting items when mouse button is clicked when selection mode is set to multi.")
CategoryAttribute("Behavior")
 get_AutoDeselectItems();
set_AutoDeselectItems(value);
[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);
}

Property Value

true to enable de-selecting; false otherwise.
Remarks
This property is used only if SelectionMode is set to RasterImageListSelectionMode.Multi.
Example
 
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()

         codecs = New RasterCodecs()

         ' Create three items
         Dim imagesPath As String = LEAD_VARS.ImagesDir

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

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


         ' 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

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
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:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RasterImageList Class
RasterImageList Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.