/// <summary>
 /// Returns padding value converted from specified
 /// <see cref="UnitOfMeasure"> to millimeters.
 /// </summary>
 /// <param name="padding">Padding value.</param>
 /// <param name="units">Measure units of input padding value.</param>
 /// <returns> Padding value converted from specified <see cref="UnitOfMeasure"> to millimeters.</returns>
 private PaddingF ConvertPaddingToMillimeters(PaddingF padding, UnitOfMeasure units)
 {
     return(new PaddingF(
                (float)UnitOfMeasureConverter.ConvertToMillimeters(padding.Left, units),
                (float)UnitOfMeasureConverter.ConvertToMillimeters(padding.Top, units),
                (float)UnitOfMeasureConverter.ConvertToMillimeters(padding.Right, units),
                (float)UnitOfMeasureConverter.ConvertToMillimeters(padding.Bottom, units)));
 }
 /// <summary>
 /// Returns padding value converted from specified
 /// <see cref="UnitOfMeasure"> to the device independent pixels.
 /// </summary>
 /// <param name="padding">Padding value.</param>
 /// <param name="units">Measure units of input padding value.</param>
 /// <returns> Padding value converted from specified
 /// <see cref="UnitOfMeasure"> to the device independent pixels.</returns>
 private PaddingF ConvertPaddingToDips(PaddingF padding, UnitOfMeasure units)
 {
     return(new PaddingF(
                (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(padding.Left, units),
                (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(padding.Top, units),
                (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(padding.Right, units),
                (float)UnitOfMeasureConverter.ConvertToDeviceIndependentPixels(padding.Bottom, units)));
 }
        /// <summary>
        /// Updates the padding panel.
        /// </summary>
        /// <param name="padding">The padding.</param>
        private void UpdatePaddingPanel(PaddingF padding)
        {
            _paddingValueUpdating = true;

            leftNumericUpDown.Value   = Convert.ToDecimal(padding.Left);
            topNumericUpDown.Value    = Convert.ToDecimal(padding.Top);
            rightNumericUpDown.Value  = Convert.ToDecimal(padding.Right);
            bottomNumericUpDown.Value = Convert.ToDecimal(padding.Bottom);
            allNumericUpDown.Value    = Convert.ToDecimal(padding.All);

            _paddingValueUpdating = false;
        }
        /// <summary>
        /// Handles the ValueChanged event of AllNumericUpDown object.
        /// </summary>
        private void allNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            // if padding value is updating
            if (_paddingValueUpdating)
            {
                return;
            }

            // update padding value
            PaddingValue = new PaddingF(Convert.ToSingle(allNumericUpDown.Value));
            OnPaddingValueChanged();
        }
        /// <summary>
        /// Handles the ValueChanged event of NumericUpDown object.
        /// </summary>
        private void numericUpDown_ValueChanged(object sender, EventArgs e)
        {
            // if padding value is updating
            if (_paddingValueUpdating)
            {
                return;
            }

            // get left padding
            float left = Convert.ToSingle(leftNumericUpDown.Value);
            // get top padding
            float top = Convert.ToSingle(topNumericUpDown.Value);
            // get right padding
            float right = Convert.ToSingle(rightNumericUpDown.Value);
            // get bottom padding
            float bottom = Convert.ToSingle(bottomNumericUpDown.Value);

            // update padding value
            PaddingValue = new PaddingF(left, top, right, bottom);
            OnPaddingValueChanged();
        }
Beispiel #6
0
        private void loaditemtext(System.Xml.XmlNode itemNode, StaticTextFormatter textItem)
        {
            if (itemNode != null)
            {
                //Load the standard styles

                System.Xml.XmlNode textColourNode    = itemNode.SelectSingleNode("@colour");
                System.Xml.XmlNode textFontNode      = itemNode.SelectSingleNode("@fontFamily");
                System.Xml.XmlNode textFontSizeNode  = itemNode.SelectSingleNode("@fontSize");
                System.Xml.XmlNode textFontStyleNode = itemNode.SelectSingleNode("@fontStyle");
                System.Xml.XmlNode alignmentNode     = itemNode.SelectSingleNode("@alignment");
                System.Xml.XmlNode marginNode        = itemNode.SelectSingleNode("@margin");

                if (textColourNode != null)
                {
                    textItem.ForeColour = Color.FromArgb(int.Parse(textColourNode.Value));
                }
                if (textFontNode != null)
                {
                    FontStyle style = FontStyle.Regular;
                    if (textFontStyleNode != null)
                    {
                        style = (FontStyle)Enum.Parse(typeof(FontStyle), textFontStyleNode.Value);
                    }
                    textItem.Font = new Font(textFontNode.Value, float.Parse(textFontSizeNode.Value, System.Globalization.CultureInfo.InvariantCulture), style);
                }
                if (alignmentNode != null)
                {
                    textItem.Alignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), alignmentNode.Value);
                }
                if (marginNode != null)
                {
                    textItem.Margin = PaddingF.Parse(marginNode.Value);
                }

                //Load Text Outline Style
                System.Xml.XmlNode outlineOpacityNode   = itemNode.SelectSingleNode("textOutline/@opacity");
                System.Xml.XmlNode outlineColourNode    = itemNode.SelectSingleNode("textOutline/@colour");
                System.Xml.XmlNode outlineThicknessNode = itemNode.SelectSingleNode("textOutline/@thickness");

                if (outlineOpacityNode != null)
                {
                    textItem.TextOutline.Opacity = float.Parse(outlineOpacityNode.Value, System.Globalization.CultureInfo.InvariantCulture);
                }
                if (outlineColourNode != null)
                {
                    textItem.TextOutline.Color = Color.FromArgb(int.Parse(outlineColourNode.Value));
                }
                if (outlineThicknessNode != null)
                {
                    textItem.TextOutline.Thickness = int.Parse(outlineThicknessNode.Value);
                }

                //Load Drop Shadow Style
                System.Xml.XmlNode shadowOpacityNode  = itemNode.SelectSingleNode("dropShadow/@opacity");
                System.Xml.XmlNode shadowColourNode   = itemNode.SelectSingleNode("dropShadow/@colour");
                System.Xml.XmlNode shadowAngleNode    = itemNode.SelectSingleNode("dropShadow/@angle");
                System.Xml.XmlNode shadowAltitudeNode = itemNode.SelectSingleNode("dropShadow/@altitude");

                if (shadowOpacityNode != null)
                {
                    textItem.DropShadow.Opacity = float.Parse(shadowOpacityNode.Value, System.Globalization.CultureInfo.InvariantCulture);
                }
                if (shadowColourNode != null)
                {
                    textItem.DropShadow.Color = Color.FromArgb(int.Parse(shadowColourNode.Value));
                }
                if (shadowAngleNode != null)
                {
                    textItem.DropShadow.Direction = int.Parse(shadowAngleNode.Value);
                }
                if (shadowAltitudeNode != null)
                {
                    textItem.DropShadow.Altitude = int.Parse(shadowAltitudeNode.Value);
                }
            }
        }
Beispiel #7
0
		public Label ()
		{
			TextColor = Color.Black;
			Padding = new PaddingF (3);
		}
Beispiel #8
0
		public Button ()
		{
			Padding = new PaddingF (10);
		}