←Select platform

ControlDropShadowOptions Structure

Summary

Options for rendering a drop shadow.

Syntax
C#
C++/CLI
public struct ControlDropShadowOptions 
public value class ControlDropShadowOptions sealed 
Remarks

Used by the following members:

For more information, refer to Image Viewer Appearance.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public ImageViewerForm _form = new ImageViewerForm(); 
public ComboBox comboBox = new ComboBox(); 
public ImageViewer _imageViewer; 
 
public void ImageViewerDropShadowExample() 
{ 
   // Get the Form's ImageViewer control 
   _imageViewer = _form.ImageViewer; 
   // Clear all the images already the viewer 
   _imageViewer.Items.Clear(); 
   // Use vertical view layout 
   _imageViewer.ViewLayout = new ImageViewerVerticalViewLayout(); 
   // Make sure the item size is larger than the image size (thumbnails mode) 
   _imageViewer.ItemSize = LeadSize.Create(200, 200); 
 
   // Add 4 items to the viewer 
   using (var codecs = new RasterCodecs()) 
   { 
      for (var page = 1; page <= 4; page++) 
      { 
         var item = new ImageViewerItem(); 
         var fileName = Path.Combine(LEAD_VARS.ImagesDir, string.Format("ocr{0}.tif", page)); 
 
         // Create a thumbnail from the image 
         using (var image = codecs.Load(fileName, page)) 
         { 
            item.Image = image.CreateThumbnail(180, 180, 24, RasterViewPerspective.TopLeft, RasterSizeFlags.Resample); 
         } 
         _imageViewer.Items.Add(item); 
      } 
   } 
 
   // Add view margin and item padding. The drop shadow are rendered inside these paddings 
   _imageViewer.ViewMargin = new Padding(20); 
   _imageViewer.ItemPadding = new Padding(20); 
   // Add a border style for both 
   _imageViewer.ImageBorderThickness = 1; 
   _imageViewer.ViewBorderThickness = 1; 
 
   // Add a combo box control to show the drop shadow modes 
   comboBox.Top = _form.ClientRectangle.Top; 
   _form.Controls.Add(comboBox); 
 
   // Add an entry for each drop shadow mode to the combo box 
   comboBox.Items.Add("No drop shadow"); 
   comboBox.Items.Add("View drop shadow"); 
   comboBox.Items.Add("Image drop shadow"); 
 
   comboBox.BringToFront(); 
 
   // User selects a drop shadow from the comboBox 
   comboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged; 
} 
 
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) 
{ 
   ComboBox comboBox = sender as ComboBox; 
   ControlDropShadowOptions dropShadowOptions; 
 
   // Clear previous view drop shadow 
   dropShadowOptions = _imageViewer.ViewDropShadow; 
   dropShadowOptions.IsVisible = false; 
   _imageViewer.ViewDropShadow = dropShadowOptions; 
 
   // Clear previous image drop shadow 
   dropShadowOptions = _imageViewer.ImageDropShadow; 
   dropShadowOptions.IsVisible = false; 
   _imageViewer.ImageDropShadow = dropShadowOptions; 
 
   switch (comboBox.SelectedItem.ToString()) 
   { 
      case "View drop shadow": 
         dropShadowOptions = _imageViewer.ViewDropShadow; 
         dropShadowOptions.Blur = 0; 
         dropShadowOptions.OffsetX = 10; 
         dropShadowOptions.OffsetY = 10; 
         dropShadowOptions.IsVisible = true; 
         _imageViewer.ViewDropShadow = dropShadowOptions; 
         break; 
      case "Image drop shadow": 
         dropShadowOptions = _imageViewer.ImageDropShadow; 
         dropShadowOptions.IsVisible = true; 
         _imageViewer.ImageDropShadow = dropShadowOptions; 
         break; 
      case "No drop shadow": 
      default: 
         break; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Controls Namespace

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

Leadtools.Controls Assembly

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