EnableKeyboard Property

Summary

Gets or sets a value indicating whether the control automatically processes the keyboard.

Syntax

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

Property Value

true if the control automatically processes the keyboard; otherwise, false. Default value is true.

Remarks

When automatic keyboard processing is enabled, the RasterImageList Control will process the following keys:

Key Event
PageUp, Up Arrow, Left Arrow Scroll up/left one item (depends on ScrollStyle)
PageDown, Down Arrow, Right Arrow Scroll down/right one item (depends on ScrollStyle)
Ctrl + PageUp, Ctrl + Up, Ctlr + Left, Home Scroll to beginning of list (depends on ScrollStyle)
Ctrl + PageDown, Ctrl + Down, Ctlr + Right, End Scroll to end of list (depends on ScrollStyle)

If the setting for SelectionMode is not RasterImageListSelectionMode.None, then the selected item will move up, down, left, or right, depending on the key(s) being processed. If SelectionMode is set to RasterImageListSelectionMode.Multi, multiple items can be selected using the CTRL and/or SHIFT keys in conjunction with the keys listed above.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
class MyForm1 : Form 
{ 
   public RasterImageList imageList; 
   public MyForm1(string title) 
   { 
      Text = title; 
 
      // Set the size of the form 
      Size = new Size(400, 200); 
 
      // Create a new RasterImageList control. 
      imageList = new RasterImageList(); 
      imageList.Bounds = new Rectangle(new Point(0, 0), Size); 
 
      imageList.Sorting = SortOrder.Ascending; 
      imageList.BorderStyle = BorderStyle.None; 
      imageList.DoubleBuffer = true; 
      imageList.Dock = DockStyle.Fill; 
      RasterPaintProperties paintProperties = imageList.PaintProperties; 
      paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic; 
      imageList.PaintProperties = paintProperties; 
      imageList.EnableKeyboard = true; 
      imageList.UseDpi = true; 
 
      // Add a handler to the PaintBackground event 
      imageList.PaintBackground += new PaintEventHandler(rasterImageList_PaintBackground); 
 
      RasterCodecs 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); 
   } 
 
 
   private void rasterImageList_PaintBackground(object sender, PaintEventArgs e) 
   { 
      // Get the image list control 
      RasterImageList imageList = sender as RasterImageList; 
 
      // Fill the background with a gradient brush 
      Rectangle rc = imageList.ClientRectangle; 
 
      Brush b = new LinearGradientBrush( 
         rc, 
         Color.Bisque, 
         Color.White, 
         LinearGradientMode.Vertical); 
      e.Graphics.FillRectangle(b, rc); 
      b.Dispose(); 
   } 
 
} 
 
public void RasterImageList_RasterImageList(string title) 
{ 
   MyForm1 form = new MyForm1(title); 
   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.