国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

條碼打印

2019-11-17 03:03:57
字體:
來源:轉載
供稿:網友

條碼打印

最近的工程要求條碼打印~~咱用了簡單的方法,直接調用條碼對象生成圖像打印--

 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4     /// <summary> 5     /// 打印編碼 6     /// </summary> 7     public sealed class PRintBarcode 8     { 9         BarcodeLib.Barcode _Barcode;10         public PrintBarcode()11         {12 13             _Barcode = new BarcodeLib.Barcode();14             _Barcode.IncludeLabel = true;15         }16 17         public System.Drawing.Image Fill(string BarcodeText)18         {19             //---12  或者13 長度   的時候用BarcodeLib.TYPE.EAN13這個編碼占小嘿嘿20             if (BarcodeText.Length >= 12 && BarcodeText.Length <= 13)21             {22                 return _Barcode.Encode(BarcodeLib.TYPE.EAN13, BarcodeText, 100, 50);23             }24 25 26              //-------------------這里可以適應小于13位置27              return _Barcode.Encode(BarcodeLib.TYPE.CODE128, BarcodeText, 100,50);28         }29 30 31 32     }

再輸出就行了哈,輸出的時候用pb.Fill適配條碼文本~~

BLL.PrintBarcode pb = new PrintBarcode();        /// <summary>        /// 打印事件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void pd_PrintPage(object sender, PrintPageEventArgs e)        {            //---循環打印消息開始打印            for (int Index = PrintIndex; Index < MessingList.PrintMessing.Count; Index++)            {                iprintMessing TempMessing = MessingList.PrintMessing[Index];                //---字體大小                int FontSize = MessingList.StyleList.Style[TempMessing.Id].FontSize;                                //----特殊碼處理                if (MessingList.StyleList.Style[TempMessing.Id].Type == PrintStyleType.Barcode)                {                    e.Graphics.DrawImage(pb.Fill(TempMessing.PrintValue), new System.Drawing.Point(TempMessing.Print_X, TempMessing.Print_Y));                                }                else                {                    e.Graphics.DrawString(TempMessing.PrintValue, new System.Drawing.Font(new System.Drawing.FontFamily("黑體"), FontSize),                        System.Drawing.Brushes.Black, TempMessing.Print_X, TempMessing.Print_Y);                }                    ////--打印后判斷是否是該頁結束                if (TempMessing.isPageEnd)                {                    if (Index >= MessingList.PrintMessing.Count - 1)                    {                        //---最后一頁從新設置                        PrintIndex = 0;                        return;                    }                    else                    {                        //---重新在執行pd_PrintPage事件                        e.HasMorePages = true;                        //---負值給打印打印指針,跳過當前索引                        PrintIndex = Index + 1;                        //---判斷一頁結束                        //----跳出循環                        return;                    }                }            }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大荔县| 灌云县| 惠州市| 隆化县| 天柱县| 芜湖市| 兴宁市| 黑河市| 特克斯县| 大邑县| 丹江口市| 云南省| 太谷县| 江都市| 焦作市| 开平市| 长葛市| 句容市| 临洮县| 锦屏县| 津市市| 南涧| 镇雄县| 辽中县| 喀喇| 松阳县| 平凉市| 宁夏| 屯门区| 涟源市| 廊坊市| 浦县| 叶城县| 共和县| 博爱县| 灵寿县| 徐闻县| 景泰县| 宜春市| 丽江市| 井研县|