←Select platform

BackgroundBrush Property


Spy glass background brush.

public virtual Brush BackgroundBrush { get; set; } 
   virtual property System::Drawing::Brush^ BackgroundBrush 
      System::Drawing::Brush^ get() 
      void set(System::Drawing::Brush^ value) 

Property Value

The spy glass background brush. The default value is null.


This property is used to fill the area outside the image in the spy glass. A value of null means do not fill the area outside the image.

using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
public ImageViewerForm _form = new ImageViewerForm(); 
public ImageViewer _imageViewer; 
public void ImageViewerSpyGlassInteractiveModeExample() 
   // Get the ImageViewer control from the form 
   _imageViewer = _form.ImageViewer; 
   // Load an image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")); 
   // Create the spyglass interactive mode 
   ImageViewerSpyGlassInteractiveMode spyGlass = new ImageViewerSpyGlassInteractiveMode(); 
   spyGlass.AutoItemMode = ImageViewerAutoItemMode.AutoSet; 
   spyGlass.BackgroundBrush = new SolidBrush(Color.FromArgb(128, Color.Yellow)); 
   spyGlass.BorderBackPen = new Pen(Color.Red); 
   spyGlass.BorderPen = new Pen(Color.Blue) { DashPattern = new float[] { 4.0F, 2.0F, 1.0F, 3.0F }}; 
   spyGlass.Crosshair = ImageViewerSpyGlassCrosshair.Fine; 
   spyGlass.CrosshairPen = new Pen(Color.Green); 
   spyGlass.EnsureVisible = false; 
   spyGlass.Offset = new LeadPoint(0, 0); 
   spyGlass.HideCursorWhileWorking = true; 
   spyGlass.IdleCursor = Cursors.Cross; 
   spyGlass.RoundRectangleRadius = new LeadSize(25, 25); 
   spyGlass.Shape = ImageViewerSpyGlassShape.RoundRectangle; 
   spyGlass.Size = new LeadSize(200, 200); 
   // Get inverted copy of the RasterImage in the Viewer control 
   RasterImage invertedRasterImage = _imageViewer.Image.Clone(); 
   InvertCommand invertCommand = new InvertCommand(); 
   // Overlay the inverted image on the spy glass 
   spyGlass.DrawImage += (object sender, ImageViewerSpyGlassDrawImageEventArgs e) => 
      Image img = RasterImageConverter.ChangeToImage(invertedRasterImage, new ChangeToImageOptions()); 
      e.Context.DrawImage(img, Point.Empty); 
      _form.Text = 
      $"Destination Rectangle: (" + 
      $"{e.DestinationRectangle.X}, {e.DestinationRectangle.Y}, {e.DestinationRectangle.Width}, {e.DestinationRectangle.Height}), " + 
      $"Offset: {e.Offset.X}, {e.Offset.Y}"; 
   // Add spyglass interactive mode 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 

Target Platforms

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.