ViewerBorderPadding Class

Summary

Determines the border padding for Leadtools ImageViewer controls.

Syntax

C#
C++/CLI
C++
public class ViewerBorderPadding 
public ref class ViewerBorderPadding  
public: 
   ref class ViewerBorderPadding 

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
 
public void ViewerBorderPaddingExample(RasterImageViewer viewer) 
{ 
   if (viewer.IsImageAvailable) 
   { 
      viewer.BorderPadding.Changed += new EventHandler(BorderPadding_Changed); 
      viewer.BorderPadding.All = 0; 
      int viewerWidth = viewer.Right - viewer.Left; 
      int viewerHeight = viewer.Bottom - viewer.Top; 
 
      int imageWidth = viewer.Image.Width; 
      int imageHeight = viewer.Image.Height; 
 
      if (imageWidth < viewerWidth) 
      { 
         viewer.BorderPadding.Left = (viewerWidth - imageWidth) / 2; 
         viewer.BorderPadding.Right = 0; 
      } 
 
      if (imageHeight < viewerHeight) 
      { 
         viewer.BorderPadding.Top = (viewerHeight - imageHeight) / 2; 
         viewer.BorderPadding.Bottom = 0; 
      } 
 
      viewer.BorderPadding.Changed -= new EventHandler(BorderPadding_Changed); 
   } 
} 
 
private void BorderPadding_Changed(System.Object sender, EventArgs e) 
{ 
   Console.WriteLine("BorderPadding Changed"); 
} 

Requirements

Target Platforms

See Also

Reference

ViewerBorderPadding Members

Leadtools.WinForms Namespace

Help Version 22.0.2023.1.24
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.