DefineBorder

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Locates the supplied element and applies provided values to the border properties.

Parameters

Element (multiple) The name of the element to apply the property definitions. The name property is assigned in the Info tab of the element properties.

Color (multiple) The variable containing the color name value. The value must be a defined color in the Template.

ColorType (multiple) Either the name or the value associated for the color definition type. Name = 0, RGB = 1, CMYK = 2.

Definition (multiple | optional) The values for the color definition. Values must be delimited with "-". Preset values for the defined color will be altered for the entire Template. Ex: CMKY = 10-20-10-100.

DashGap (multiple | optional) The measurement representing the gap between dots or dashes. The element will only use this value if they border is preset as Dashed or Dotted. The default value is “5pt”.

DashSize (multiple | optional) The measurement representing the length of dashes. The element will only use this value if they border is preset as Dashed. The default value is “10pt”.

Thickness (multiple | optional) The measurement representing the border thickness. The default value is “2.5pt”).

Tint (multiple | optional) Percentage of the Fill Color to apply to the element (0% - 100%). Default is 100%.

ErrorMessage (multiple | optional) The error message to return when any error occurs.

Synopsis

This method offers multiple possibilities for defining the border element with that that capability. Regardless of method used, a color must be defined in the template. You can use the definition parameter to redefine the values for the color.

Source Code

public static void DefineBorder(object Element, object Color, object ColorType, object Definition,
	object DashGap, object DashSize, object Thickness, object Tint,
	object ErrorMessage)
{
	Break();
	try
	{
		IBorderStyle border = (IBorderStyle)Application.CurrentDocument.FindElement((string)Element);

		border.BorderColor = DefinedColor(Color, ColorType, Definition);
		border.BorderThickness = (string)Thickness == String.Empty ? "2.5pt" : Thickness.ToString().ToLower();
		border.BorderTint = (string)Tint == String.Empty ? 100 : N(Tint.ToString().Replace("%", ""));

		if (border.BorderStyle == BorderStyle.Dashed || border.BorderStyle == BorderStyle.Dotted)
		{
			border.BorderDashGap = (string)DashGap == String.Empty ? "5pt" : DashGap.ToString().ToLower();
			if (border.BorderStyle == BorderStyle.Dashed)
			{
				border.BorderDashSize = (string)DashSize == String.Empty ? "10pt" : DashSize.ToString().ToLower();
			}
		}
	}
	catch (Exception ex)
	{
		throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
	}
}

Referenced Methods

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.