Ejemplo n.º 1
0
        public Tools.Length GetTopMargin()
        {
            Tools.Length TopMargin = labelLayout.TopMargin;
            String       OffsetKey = string.Format("{0}@{1}", Printer, Machine);

            if (Offsets.ContainsKey(OffsetKey)) // Use specific offset if it exists
            {
                Offset offset = Offsets[OffsetKey];
                TopMargin += offset.TopMarginOffset;
            }
            else if (Offsets.ContainsKey("@")) //Use default offset if no specific one exists.
            {
                Offset offset = Offsets["@"];
                TopMargin += offset.TopMarginOffset;
            }
            //if (TopMargin > PhysicalTopMargin)
            //{
            TopMargin -= PhysicalTopMargin;
            //}
            //else
            //{
            //    TopMargin = new Tools.Length(0, new Tools.CoordinateSystem.Units(System.Drawing.GraphicsUnit.Millimeter));
            //}

            return(TopMargin);
        }
Ejemplo n.º 2
0
        public Tools.Size GetPhysicalLabelSize()
        {
            if (labelLayout == null)
            {
                throw new ApplicationException("Please, parse a paper definition first");
            }

            Tools.Length NettoWidthPage  = size.Width;
            Tools.Length NettoHeightPage = size.Height;
            return(new ACA.LabelX.Tools.Size(NettoWidthPage, NettoHeightPage));
        }
Ejemplo n.º 3
0
 public Tools.Length GetVerticalInterlabelGap()
 {
     Tools.Length VerticalInterlabelGap = labelLayout.VerticalInterlabelGap;
     //String OffsetKey = string.Format("{0}@{1}", Printer, Machine);
     //if (Offsets.ContainsKey(OffsetKey))
     //{
     //    Offset offset = Offsets[OffsetKey];
     //    VerticalInterlabelGap += offset.VerticalInterlabelGapOffset;
     //}
     return(VerticalInterlabelGap);
 }
Ejemplo n.º 4
0
        public Tools.Rectangle GetLabelRectangle(int HorizontalIndex, int VerticalIndex)
        {
            if (labelLayout == null)
            {
                throw new ApplicationException("Please, parse a paper definition first");
            }

            Tools.Length Left = GetLeftMargin() + ((GetLabelSize().Width + GetHorizontalInterlabelGap()) * HorizontalIndex);
            Tools.Length Top  = GetTopMargin() + ((GetLabelSize().Height + GetVerticalInterlabelGap()) * VerticalIndex);

            Tools.Rectangle rect = new Tools.Rectangle(Left, Top, GetLabelSize());
            return(rect);
        }
Ejemplo n.º 5
0
        public Tools.Size GetPrintablePageSize()
        {
            if (labelLayout == null)
            {
                throw new ApplicationException("Please, parse a paper definition first");
            }

            Tools.Length NettoWidthPage  = size.Width - (labelLayout.LeftMargin * 2);
            Tools.Length NettoHeightPage = size.Height - (labelLayout.TopMargin * 2);

            /* //JBOS
             * Tools.Length NettoWidthPage = size.Width - (GetLeftMargin()+ GetRightMargin());
             * Tools.Length NettoHeightPage = size.Height - (GetTopMargin()+GetBottomMargin());
             *///JBOS
            return(new ACA.LabelX.Tools.Size(NettoWidthPage, NettoHeightPage));
        }
Ejemplo n.º 6
0
        public Tools.Size GetLabelSize()
        {
            if (labelLayout == null)
            {
                throw new ApplicationException("Please, parse a paper definition first");
            }

            Tools.Size NettoPageSize = GetPrintablePageSize();

            Tools.Length TotalHorizontalInterlabelGap = GetHorizontalInterlabelGap() * (int)(labelLayout.HorizontalCount - 1);
            Tools.Length LabelWidth = (NettoPageSize.Width - TotalHorizontalInterlabelGap) / (int)labelLayout.HorizontalCount;

            Tools.Length TotalVerticalInterlabelGap = GetVerticalInterlabelGap() * (int)(labelLayout.VerticalCount - 1);
            Tools.Length LabelHeight = (NettoPageSize.Height - TotalVerticalInterlabelGap) / (int)labelLayout.VerticalCount;

            return(new Tools.Size(LabelWidth, LabelHeight));
        }
Ejemplo n.º 7
0
        public void Parse(XmlNode node)
        {
            HorizontalCount         = 0;
            VerticalCount           = 0;
            TopMargin               = null;
            LeftMargin              = null;
            HorizontalInterlabelGap = null;
            VerticalInterlabelGap   = null;

            foreach (XmlNode nodex in node)
            {
                if (nodex.Name.Equals("horizontal", StringComparison.OrdinalIgnoreCase))
                {
                    HorizontalCount = Convert.ToUInt32(nodex.InnerText);
                }
                else if (nodex.Name.Equals("vertical", StringComparison.OrdinalIgnoreCase))
                {
                    VerticalCount = Convert.ToUInt32(nodex.InnerText);
                }
                else if (nodex.Name.Equals("horzoffset", StringComparison.OrdinalIgnoreCase))
                {
                    LeftMargin = new ACA.LabelX.Tools.Length(DefaultUnits);
                    LeftMargin.Parse(nodex);
                }
                else if (nodex.Name.Equals("vertoffset", StringComparison.OrdinalIgnoreCase))
                {
                    TopMargin = new ACA.LabelX.Tools.Length(DefaultUnits);
                    TopMargin.Parse(nodex);
                }
                else if (nodex.Name.Equals("horzinterlabelgap", StringComparison.OrdinalIgnoreCase))
                {
                    HorizontalInterlabelGap = new ACA.LabelX.Tools.Length(DefaultUnits);
                    HorizontalInterlabelGap.Parse(nodex);
                }
                else if (nodex.Name.Equals("vertinterlabelgap", StringComparison.OrdinalIgnoreCase))
                {
                    VerticalInterlabelGap = new ACA.LabelX.Tools.Length(DefaultUnits);
                    VerticalInterlabelGap.Parse(nodex);
                }
            }
        }
Ejemplo n.º 8
0
        public void Parse(XmlNode node)
        {
            TopMarginOffset  = null;
            LeftMarginOffset = null;
            HorizontalInterlabelGapOffset = null;
            VerticalInterlabelGapOffset   = null;
            Machine = null;
            Printer = null;

            foreach (XmlAttribute attrib in node.Attributes)
            {
                if (attrib.Name.Equals("horzoffset", StringComparison.OrdinalIgnoreCase))
                {
                    LeftMarginOffset = new Tools.Length(Convert.ToInt32(attrib.Value), DefaultUnits);
                }
                else if (attrib.Name.Equals("vertoffset", StringComparison.OrdinalIgnoreCase))
                {
                    TopMarginOffset = new Tools.Length(Convert.ToInt32(attrib.Value), DefaultUnits);
                }
                else if (attrib.Name.Equals("horzinterlabelgapdelta", StringComparison.OrdinalIgnoreCase))
                {
                    HorizontalInterlabelGapOffset = new Tools.Length(Convert.ToInt32(attrib.Value), DefaultUnits);
                }
                else if (attrib.Name.Equals("vertinterlabeldelta", StringComparison.OrdinalIgnoreCase))
                {
                    VerticalInterlabelGapOffset = new Tools.Length(Convert.ToInt32(attrib.Value), DefaultUnits);
                }
                else if (attrib.Name.Equals("machine", StringComparison.OrdinalIgnoreCase))
                {
                    Machine = attrib.Value;
                }
                else if (attrib.Name.Equals("printer", StringComparison.OrdinalIgnoreCase))
                {
                    Printer = attrib.Value;
                }
            }
        }