Determines the border padding for Leadtools ImageViewer controls.
public class ViewerBorderPadding
Public Class ViewerBorderPadding
public ref class ViewerBorderPadding
Public Sub ViewerBorderPaddingExample(ByVal viewer As RasterImageViewer)
If (viewer.IsImageAvailable) Then
AddHandler viewer.BorderPadding.Changed, AddressOf BorderPadding_Changed
viewer.BorderPadding.All = 0
Dim viewerWidth As Integer = viewer.Right - viewer.Left
Dim viewerHeight As Integer = viewer.Bottom - viewer.Top
Dim imageWidth As Integer = viewer.Image.Width
Dim imageHeight As Integer = viewer.Image.Height
If (imageWidth < viewerWidth) Then
viewer.BorderPadding.Left = (viewerWidth - imageWidth) \ 2
viewer.BorderPadding.Right = 0
End If
If (imageHeight < viewerHeight) Then
viewer.BorderPadding.Top = (viewerHeight - imageHeight) \ 2
viewer.BorderPadding.Bottom = 0
End If
RemoveHandler viewer.BorderPadding.Changed, AddressOf BorderPadding_Changed
End If
End Sub
Private Sub BorderPadding_Changed(ByVal sender As Object, ByVal e As EventArgs)
Console.WriteLine("BorderPadding Changed")
End Sub
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");
}
![]() |
Products |
Support |
Feedback: ViewerBorderPadding Class - Leadtools.WinForms |
Introduction |
Help Version 19.0.2017.3.22
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
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.