Infragistics(R) NetAdvantage(R) Windows Forms
GetBorderWidths Method
See Also  Example E-mail your feedback on this topic.
Infragistics.Win Namespace > UIElement Class : GetBorderWidths Method

style
The UIElementBorderStyle of the element.
sides
A System.Windows.Forms.Border3DSide object describing which borders are present.
Returns the widths of all four borders

Syntax

Visual Basic (Declaration) 
Public Overridable Function GetBorderWidths( _
   ByVal style As UIElementBorderStyle, _
   ByVal sides As Border3DSide _
) As UIElementBorderWidths
C# 
public virtual UIElementBorderWidths GetBorderWidths( 
   UIElementBorderStyle style,
   Border3DSide sides
)

Parameters

style
The UIElementBorderStyle of the element.
sides
A System.Windows.Forms.Border3DSide object describing which borders are present.

Return Value

A UIElementBorderWidths object.

Example

This sample returns the pixel height of the top and bottom borders on the element passed in.

Visual BasicCopy Code
Imports Infragistics.Win
		
  Private Function CombinedBorderHeight(ByVal element As UIElement) As Integer
   
  ' Returns the pixel height of the top and bottom borders on the element passed in.
      Dim borderwidths As UIElementBorderWidths = element.GetBorderWidths(element.BorderStyle, element.BorderSides)

      Return borderwidths.Top + borderwidths.Bottom

  End Function
C#Copy Code
using Infragistics.Win;

private int CombinedBorderHeight(UIElement element)
{
 
	// Returns the pixel height of the top and bottom borders on the element passed in.
	UIElementBorderWidths borderwidths = element.GetBorderWidths( element.BorderStyle,element.BorderSides );

	return borderwidths.Top + borderwidths.Bottom;

}

See Also