DefineBackgroundColor

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Locates the supplied element and applies color to the background property.

Parameters

Element (multiple) The name of the element to apply coloring. 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.

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 a background color on any element with that property. 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 DefineBackgroundColor(object Element, object Color, object ColorType, object Definition, object Tint, object ErrorMessage)
{
	Break();
	try
	{
		IFillStyle fill = (IFillStyle)Application.CurrentDocument.FindElement((string)Element);
		fill.FillColor = DefinedColor(Color, ColorType, Definition);
		fill.FillTint = (string)Tint == String.Empty ? 100 : N(Tint.ToString().Replace("%", ""));
	}
	catch (Pageflex.Scripting.Exceptions.ColorNotFoundException err)
	{
		throw new Four51ActionsException(err.Message);
	}
	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.