示例#1
0
		public void addPages(string sLabelFormat, List<LabelInfo> lItems)
		{
			lFormats = new List<LabelEntryBase>();

			string[] sTextList = sLabelFormat.Split(new char[] { '~' });
			foreach (string sItem in sTextList)
			{
				if (sItem.Length > 0) lFormats.Add(LabelEntryBase.create(sItem));
			}

			if (lItems == null)
			{
				LabelPage lpNew = new LabelPage();
				lpNew.populate(lFormats);
				lPages.Add(lpNew);
			}
			else
			{
				if (lItems.Count() == 0) return;

				int iMaxRepeat = getMaxRepeat(lFormats);
				int iCount = (int)Math.Ceiling((decimal)lItems.Count() / iMaxRepeat);

				for (int iX = 0; iX < iCount; iX++)
				{
					LabelPage lpNew = new LabelPage();
					lpNew.populate(lFormats, lItems, iX * iMaxRepeat);
					lPages.Add(lpNew);
				}
			}
		}
示例#2
0
        public void addPages(string sLabelFormat, List <LabelInfo> lItems)
        {
            lFormats = new List <LabelEntryBase>();

            string[] sTextList = sLabelFormat.Split(new char[] { '~' });
            foreach (string sItem in sTextList)
            {
                if (sItem.Length > 0)
                {
                    lFormats.Add(LabelEntryBase.create(sItem));
                }
            }

            if (lItems == null)
            {
                LabelPage lpNew = new LabelPage();
                lpNew.populate(lFormats);
                lPages.Add(lpNew);
            }
            else
            {
                int iMaxRepeat = getMaxRepeat(lFormats);

                if (lItems.Count() == 0 || iMaxRepeat == 0)
                {
                    return;
                }

                int iCount = (int)Math.Ceiling((decimal)lItems.Count() / iMaxRepeat);

                for (int iX = 0; iX < iCount; iX++)
                {
                    LabelPage lpNew = new LabelPage();
                    lpNew.populate(lFormats, lItems, iX * iMaxRepeat);
                    lPages.Add(lpNew);
                }
            }
        }
示例#3
0
        public static void printLabel(Graphics gPage, LabelPage lpPage)
        {
            foreach (LabelEntry leItem in lpPage.leEntries)
            {
                switch (leItem.iType)
                {
                    case LabelEntry.TYPE_STRING:
                    case LabelEntry.TYPE_LABEL:
                        drawString(gPage, leItem.sFontName, leItem.fSize, leItem.sText, iPageWidth * leItem.fStartX, iPageHeight * leItem.fStartY, leItem.iAlignX, leItem.iAlignY);
                        break;

                    case LabelEntry.TYPE_LINE:
                        Pen pLine = new Pen(Brushes.Black, leItem.fSize);
                        gPage.DrawLine(pLine, iPageWidth * leItem.fStartX, iPageHeight * leItem.fStartY, iPageWidth * leItem.fEndX, iPageHeight * leItem.fEndY);
                        break;

                    case LabelEntry.TYPE_BARCODE:
                        float offsetX = 0, offsetY = 0;

                        BarcodeWriter bw = new BarcodeWriter();
                        bw.Format = BarcodeFormat.CODE_128;
                        bw.Options = new EncodingOptions { Width = leItem.iWidth, Height = leItem.iHeight, PureBarcode = true };

                        Image ibc = (Image)bw.Write(leItem.sText);

                        switch (leItem.iAlignX)
                        {
                            case 1: break;
                            case 2: offsetX = leItem.iWidth * 0.5f; break;
                            case 3: offsetX = leItem.iWidth; break;
                        }

                        switch (leItem.iAlignY)
                        {
                            case 1: break;
                            case 2: offsetY = leItem.iHeight * 0.5f; break;
                            case 3: offsetY = leItem.iHeight; break;
                        }

                        gPage.DrawImage(ibc, (iPageWidth * leItem.fStartX) - offsetX, (iPageHeight * leItem.fStartY) - offsetY);
                        break;
                }
            }
        }
示例#4
0
        public void addBlank()
        {
            LabelPage lpNew = new LabelPage();

            lPages.Add(lpNew);
        }
示例#5
0
		public void addBlank()
		{
			LabelPage lpNew = new LabelPage();
			lPages.Add(lpNew);
		}