SelectUserImage Property

Summary

Gets or sets a user-defined image to use as the selection marker.

Syntax

C#
C++/CLI
C++
public RasterImage SelectUserImage { get; set; } 
[BrowsableAttribute(false)] 
public: 
property RasterImage^ SelectUserImage { 
   RasterImage^ get(); 
   void set (    RasterImage^ ); 
} 
public:  
   property RasterImage^ SelectUserImage 
   { 
      RasterImage^ get() 
      void set(RasterImage^ value) 
   } 

Property Value

A user-defined Leadtools.RasterImage to use as the selection marker. Default value is null (Nothing in VB).

Remarks

The user defined image selection marker is used only when ViewStyle is set to RasterImageListViewStyle.Normal. It is ignored in all other styles.

When you set an image into the SelectUserImage, the specified image will be displayed around each selected item.

Normally, you would want to set a transparent color into this image using the RasterImage.Transparent and RasterImage.TransparentColor properties of the Leadtools.RasterImage class.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
/// This example will use a user-defined image as the selection marker of an <see cref="RasterImageList"/> control. 
public void RasterImageList_SelectUserImage(RasterImageList imageList) 
{ // Use "Normal" view style 
   imageList.ViewStyle = RasterImageListViewStyle.Normal; 
 
   // Create the user-defined image to use as the selection marker (an ellipse) 
   RasterColor[] palette = new RasterColor[0]; 
   RasterImage selectImage = new RasterImage( 
      RasterMemoryFlags.Conventional, 
      imageList.ItemSize.Width, 
      imageList.ItemSize.Height, 
      24, 
      RasterByteOrder.Bgr, 
      RasterViewPerspective.TopLeft, 
      palette, 
      IntPtr.Zero, 
      0); 
 
   // Draw the ellipse 
   IntPtr hdc = RasterImagePainter.CreateLeadDC(selectImage); 
   Graphics g = Graphics.FromHdc(hdc); 
 
   Rectangle rc = new Rectangle(0, 0, selectImage.ImageWidth, selectImage.ImageHeight); 
   g.FillRectangle(Brushes.Black, rc); 
   for (int i = 0; i < 4; i++) 
   { 
      g.DrawEllipse(Pens.Red, rc.Left, rc.Top, rc.Width - 1, rc.Height - 1); 
      rc.Inflate(-1, -1); 
   } 
 
   g.Dispose(); 
   RasterImagePainter.DeleteLeadDC(hdc); 
 
   // Set the transparent color 
   selectImage.Transparent = true; 
   selectImage.TransparentColor = RasterColor.FromKnownColor(RasterKnownColor.Black); 
 
   // Set this image as the selection marker 
   imageList.SelectUserImage = selectImage; 
} 

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.