コード例 #1
0
 public void SaveToStyle(ObjectStyle style)
 {
     style.Width          = Width;
     style.Height         = Height;
     style.RelativeWidth  = RelativeWidth;
     style.RelativeHeight = RelativeHeight;
 }
コード例 #2
0
        public object Clone()
        {
            ObjectStyle clone = (ObjectStyle)MemberwiseClone();

            clone.PropertyChanged = null;
            return(clone);
        }
コード例 #3
0
 public void Clear(ObjectStyle defaultStyle)
 {
     xStart                = defaultStyle.XStart;
     yStart                = defaultStyle.YStart;
     relativeWidth         = defaultStyle.RelativeWidth;
     width                 = defaultStyle.Width;
     relativeHeight        = defaultStyle.RelativeHeight;
     height                = defaultStyle.Height;
     hPadding              = vPadding = defaultStyle.Padding;
     hPadding              = defaultStyle.HPadding;
     vPadding              = defaultStyle.VPadding;
     hFill                 = defaultStyle.HFill;
     vFill                 = defaultStyle.VFill;
     border                = defaultStyle.Border;
     innerHorizontalBorder = innerVerticalBorder = defaultStyle.InnerBorder;
     innerHorizontalBorder = defaultStyle.InnerHorizontalBorder;
     innerVerticalBorder   = defaultStyle.InnerVerticalBorder;
     spacing               = defaultStyle.Spacing;
     innerHSpacing         = innerVSpacing = defaultStyle.InnerSpacing;
     innerHSpacing         = defaultStyle.InnerHSpacing;
     innerVSpacing         = defaultStyle.InnerVSpacing;
     hAlign                = defaultStyle.HAlign;
     vAlign                = defaultStyle.VAlign;
     drawEmpty             = defaultStyle.DrawEmpty;
     allowHBreak           = defaultStyle.AllowHBreak;
     allowVBreak           = defaultStyle.AllowVBreak;
     bgColor               = defaultStyle.BgColor;
     fgColor               = defaultStyle.FgColor;
     borderColor           = defaultStyle.BorderColor;
 }
コード例 #4
0
ファイル: Table.cs プロジェクト: curiousTauseef/warehouse-2
        public Table()
        {
            SetDefaultStyle("vfill:true;border:1;innerborder:1");
            headerStyle = (ObjectStyle)defaultHeaderStyle.Clone();
            itemStyle   = (ObjectStyle)defaultItemStyle.Clone();
            footerStyle = (ObjectStyle)defaultFooterStyle.Clone();

            childDistribution = ObjectStyle.ChildDistribution.Vertical;

            rows.ListChanged    += OnChildObjectsListChanged;
            columns.ListChanged += Columns_ListChanged;
        }
コード例 #5
0
 public void LoadFromStyle(ObjectStyle style, bool silent = false)
 {
     if (silent)
     {
         width          = style.Width;
         height         = style.Height;
         relativeWidth  = style.RelativeWidth;
         relativeHeight = style.RelativeHeight;
     }
     else
     {
         Width          = style.Width;
         Height         = style.Height;
         RelativeWidth  = style.RelativeWidth;
         RelativeHeight = style.RelativeHeight;
     }
 }
コード例 #6
0
        public TableColumn(string columnName, string caption)
        {
            const string styleString = "padding:4;halign:left;valign:center;width:10%;vfill:true;hfill:true;allowhbreak:false;allowvbreak:false;";

            SetDefaultStyle(styleString);

            TextBox headerTextBox = DocumentHelper.FormObjectCreator.CreateTextBox();

            headerTextBox.Text = caption;
            headerTemplate.Add(headerTextBox);
            headerStyle = new ObjectStyle(styleString);

            TextBox itemTextBox = DocumentHelper.FormObjectCreator.CreateTextBox();

            itemTextBox.SourceField = columnName;
            itemTemplate.Add(itemTextBox);
            itemStyle = new ObjectStyle(styleString);

            TextBox footerTextBox = DocumentHelper.FormObjectCreator.CreateTextBox();

            footerTextBox.Text = caption;
            footerTemplate.Add(footerTextBox);
            footerStyle = new ObjectStyle(styleString);
        }
コード例 #7
0
 private XElement AddTemplate(ICollection <FormObject> template, string templateName, ObjectFont templateFont, ObjectStyle templateStyle)
 {
     if (template.Count > 0)
     {
         XElement templateElement = new XElement(templateName);
         if (templateFont != null)
         {
             AddAttribute("font", templateFont, templateElement);
         }
         if (templateStyle != null)
         {
             AddAttribute("style", templateStyle.ToString(DefaultStyle), templateElement);
         }
         foreach (FormObject childObject in template)
         {
             templateElement.Add(childObject.GetXmlElement());
         }
         return(templateElement);
     }
     return(null);
 }
コード例 #8
0
        public string ToString(ObjectStyle defaultStyle)
        {
            StringBuilder sb = new StringBuilder();

            if (!Number.IsEqualTo(xStart, defaultStyle.xStart))
            {
                sb.AppendFormat("xstart:{0};", xStart);
            }

            if (!Number.IsEqualTo(yStart, defaultStyle.yStart))
            {
                sb.AppendFormat("ystart:{0};", yStart);
            }

            if (relativeWidth != defaultStyle.relativeWidth)
            {
                sb.AppendFormat("width:{0}%;", relativeWidth ?? 100);
            }

            if (width != defaultStyle.width)
            {
                sb.AppendFormat("width:{0};", width ?? 0);
            }

            if (relativeHeight != defaultStyle.relativeHeight)
            {
                sb.AppendFormat("height:{0}%;", relativeHeight ?? 100);
            }

            if (height != defaultStyle.height)
            {
                sb.AppendFormat("height:{0};", height ?? 0);
            }

            if (hPadding == vPadding &&
                ((hPadding != defaultStyle.hPadding || vPadding != defaultStyle.vPadding)))
            {
                sb.AppendFormat("padding:{0};", Padding ?? 0);
            }
            else
            {
                if (hPadding != defaultStyle.hPadding)
                {
                    sb.AppendFormat("hpadding:{0};", hPadding ?? 0);
                }

                if (vPadding != defaultStyle.vPadding)
                {
                    sb.AppendFormat("vpadding:{0};", vPadding ?? 0);
                }
            }

            if (hFill != defaultStyle.hFill)
            {
                sb.AppendFormat("hfill:{0};", (hFill ?? false).ToString().ToLower());
            }

            if (vFill != defaultStyle.vFill)
            {
                sb.AppendFormat("vfill:{0};", (vFill ?? false).ToString().ToLower());
            }

            if (border != defaultStyle.border)
            {
                sb.AppendFormat("border:{0};", border ?? 0);
            }

            if (innerVerticalBorder == innerHorizontalBorder &&
                (innerVerticalBorder != defaultStyle.innerVerticalBorder || innerHorizontalBorder != defaultStyle.innerHorizontalBorder))
            {
                sb.AppendFormat("innerborder:{0};", InnerBorder ?? 0);
            }
            else
            {
                if (innerHorizontalBorder != defaultStyle.innerHorizontalBorder)
                {
                    sb.AppendFormat("innerhborder:{0};", innerHorizontalBorder ?? 0);
                }

                if (innerVerticalBorder != defaultStyle.innerVerticalBorder)
                {
                    sb.AppendFormat("innervborder:{0};", innerVerticalBorder ?? 0);
                }
            }

            if (spacing != defaultStyle.spacing)
            {
                sb.AppendFormat("spacing:{0};", spacing ?? 0);
            }

            if (innerVSpacing == innerHSpacing &&
                (innerVSpacing != defaultStyle.innerVSpacing || innerHSpacing != defaultStyle.innerHSpacing))
            {
                sb.AppendFormat("innerspacing:{0};", InnerSpacing ?? 0);
            }
            else
            {
                if (innerHSpacing != defaultStyle.innerHSpacing)
                {
                    sb.AppendFormat("innerhspacing:{0};", innerHSpacing ?? 0);
                }

                if (innerVSpacing != defaultStyle.innerVSpacing)
                {
                    sb.AppendFormat("innervspacing:{0};", innerVSpacing ?? 0);
                }
            }

            if (HAlign != HorizontalAlignment.Left && HAlign != defaultStyle.HAlign)
            {
                switch (HAlign)
                {
                case HorizontalAlignment.Right:
                    sb.Append("halign:right;");
                    break;

                case HorizontalAlignment.Center:
                    sb.Append("halign:center;");
                    break;
                }
            }

            if (VAlign != VerticalAlignment.Top && VAlign != defaultStyle.VAlign)
            {
                switch (VAlign)
                {
                case VerticalAlignment.Bottom:
                    sb.Append("valign:bottom;");
                    break;

                case VerticalAlignment.Center:
                    sb.Append("valign:center;");
                    break;
                }
            }

            if (DrawEmpty != defaultStyle.DrawEmpty)
            {
                sb.AppendFormat("drawempty:{0};", DrawEmpty.ToString().ToLowerInvariant());
            }

            if (AllowHBreak != defaultStyle.AllowHBreak)
            {
                sb.AppendFormat("allowhbreak:{0};", AllowHBreak.ToString().ToLowerInvariant());
            }

            if (AllowVBreak != defaultStyle.AllowVBreak)
            {
                sb.AppendFormat("allowvbreak:{0};", AllowVBreak.ToString().ToLowerInvariant());
            }

            if (!bgColor.Equal(defaultStyle.BgColor))
            {
                sb.AppendFormat("bgcolor:{0};", BgColor.ToHTMLColor());
            }

            if (!fgColor.Equal(defaultStyle.FgColor))
            {
                sb.AppendFormat("fgcolor:{0};", FgColor.ToHTMLColor());
            }

            if (!borderColor.Equals(defaultStyle.BorderColor))
            {
                sb.AppendFormat("bordercolor:{0};", BorderColor.ToHTMLColor());
            }

            return(sb.ToString().TrimEnd(';'));
        }
コード例 #9
0
 public Rectangle()
 {
     style             = new ObjectStyle();
     childDistribution = ObjectStyle.ChildDistribution.Mixed;
 }
コード例 #10
0
 protected void SetDefaultStyle(string styleString)
 {
     defaultStyle = new ObjectStyle(styleString);
     style        = new ObjectStyle(styleString);
 }
コード例 #11
0
ファイル: Line.cs プロジェクト: curiousTauseef/warehouse-2
 protected Line()
 {
     style = new ObjectStyle();
     SetDefaultStyle("hfill:true;vfill:true");
 }