Ejemplo n.º 1
0
        private StringFormat GetStringFormat()
        {
            StringFormat format = StringFormat.GenericDefault;

            switch (LabelAlignment.Vertical)
            {
            case VerticalAlignment.Top:
                format.LineAlignment = StringAlignment.Near;
                break;

            case VerticalAlignment.Middle:
                format.LineAlignment = StringAlignment.Center;
                break;

            case VerticalAlignment.Bottom:
                format.LineAlignment = StringAlignment.Far;
                break;
            }

            switch (LabelAlignment.Horizontal)
            {
            case HorizontalAlignment.Left:
                format.Alignment = StringAlignment.Near;
                break;

            case HorizontalAlignment.Center:
                format.Alignment = StringAlignment.Center;
                break;

            case HorizontalAlignment.Right:
                format.Alignment = StringAlignment.Far;
                break;
            }

            if (RightToLeft.ToString() != null)
            {
                format.FormatFlags = (StringFormatFlags)(format.FormatFlags | StringFormatFlags.DirectionRightToLeft);
            }

            if (LabelWrap)
            {
                format.FormatFlags = (StringFormatFlags)(format.FormatFlags & ~StringFormatFlags.NoWrap);
            }
            else
            {
                format.FormatFlags = (StringFormatFlags)(format.FormatFlags | StringFormatFlags.NoWrap);
            }

            return(format);
        }
Ejemplo n.º 2
0
        private void SavePropertiesXml(string xmlPath)
        {
            var xmlDocument = new XmlDocument();

            var xmlDeclaration = xmlDocument.CreateXmlDeclaration(@"1.0", @"utf-8", null);

            xmlDocument.InsertBefore(xmlDeclaration, xmlDocument.DocumentElement);

            var xmlNode = xmlDocument.AppendChild(xmlDocument.CreateElement(@"localization"));

            xmlNode = xmlNode.AppendChild(xmlDocument.CreateElement(@"locale"));

            xmlNode.AppendChild(xmlDocument.CreateNode(XmlNodeType.Element, @"name", @"")).InnerText = Name;
            xmlNode.AppendChild(xmlDocument.CreateNode(XmlNodeType.Element, @"rtl", @"")).InnerText  =
                RightToLeft.ToString().ToLower();
            xmlNode.AppendChild(xmlDocument.CreateNode(XmlNodeType.Element, @"parentLocale", @"")).InnerText =
                ParentLocale;

            xmlDocument.Save(xmlPath);
        }