Options for rendering a drop shadow.
public struct ControlDropShadowOptions
public value class ControlDropShadowOptions sealed
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";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.