本站首页    管理页面    写新日志    退出

The Neurotic Fishbowl

[学习公共库]条码打印
麦林 发表于 2008/11/20 9:12:14

        [DllImport("Winppla.dll")]        private static extern int A_CreatePrn(int selection, string filename);        [DllImport("Winppla.dll")]        private static extern void A_Clear_Memory();        [DllImport("Winppla.dll")]        private static extern int A_Set_Darkness(int heat);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Barcode(int x, int y, int ori, char type, int narrow, int width, int height, char mode, int numeric, string data);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Text_TrueType(int x, int y, int FSize, string FType, int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name, string data, int mem_mode);        [DllImport("Winppla.dll")]        private static extern int A_Print_Out(int width, int height, int copies, int amount);        [DllImport("Winppla.dll")]        private static extern void A_ClosePrn();         void Confim_Click(object sender, EventArgs e)        {            int x = 30;            int y = 1;            A_CreatePrn(1, "NULL");            A_Clear_Memory();            A_Set_Darkness(8);            A_Prn_Barcode(x, y + 30, 1,'e',1,1, 30, 'N', 1, Barcodeno);            A_Prn_Text_TrueType(x, y + 20, 18, "宋体", 1, 700, 0, 0, 0, "AB", "123456789", 1);            A_Print_Out(1, 1, LabelCount, 1);            A_ClosePrn();            this.Close();        }

阅读全文(9533) | 回复(3) | 编辑 | 精华

 


回复:条码打印
dml(游客)发表评论于2009/8/11 17:14:03

class PrintTxm : Jeez.Runtime.Base.General.GeneralUI    {        public static string Num;        public static string Unit;         public Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox IfName;        public Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox IfContact;        public Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox IfMufact;        public Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox IfPrice;        public Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox IfBarde;        public Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox IfUnit;        public Jeez.Control.UltraButton.JeezUltraButton Confim;        public Jeez.Control.UltraButton.JeezUltraButton Cancle;        public Jeez.Control.JeezNumberTextBox.JeezNumberTextBox count;         public override bool LoadUI()        {            bool b = base.LoadUI();            IfName = base.GetControlByName("JeezCheckBox4") as Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox;            IfContact = base.GetControlByName("JeezCheckBox1") as Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox;            IfMufact = base.GetControlByName("JeezCheckBox5") as Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox;            IfPrice = base.GetControlByName("JeezCheckBox2") as Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox;            IfBarde = base.GetControlByName("JeezCheckBox6") as Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox;            IfUnit = base.GetControlByName("JeezCheckBox3") as Jeez.Control.JeezUltraCheckBox.JeezUltraCheckBox;            Confim = base.GetControlByName("JeezButton1") as Jeez.Control.UltraButton.JeezUltraButton;            Cancle = base.GetControlByName("JeezButton2") as Jeez.Control.UltraButton.JeezUltraButton;            count = base.GetControlByName("JeezNumberTextBox1") as Jeez.Control.JeezNumberTextBox.JeezNumberTextBox;            Confim.Click += new EventHandler(Confim_Click);            Cancle.Click += new EventHandler(Cancle_Click);            return b;        }         protected override void GereralUI_Load(object sender, EventArgs e)        {            base.GereralUI_Load(sender, e);            IfName.Checked = true;            IfContact.Checked = true;            IfMufact.Checked = true;            IfBarde.Checked = true;        }         [DllImport("Winppla.dll")]        private static extern void A_Clear_Memory();        [DllImport("Winppla.dll")]        private static extern void A_ClosePrn();        [DllImport("Winppla.dll")]        private static extern int A_CreatePrn(int selection, string filename);        [DllImport("Winppla.dll")]        private static extern int A_Del_Graphic(int mem_mode, string graphic);        [DllImport("Winppla.dll")]        private static extern int A_Draw_Box(char mode, int x, int y, int width, int height, int top, int side);        [DllImport("Winppla.dll")]        private static extern int A_Draw_Line(char mode, int x, int y, int width, int height);        [DllImport("Winppla.dll")]        private static extern void A_Feed_Label();        [DllImport("Winppla.dll")]        private static extern int A_Get_Graphic(int x, int y, int mem_mode, char format, string filename);        [DllImport("Winppla.dll")]        private static extern int A_Get_Graphic_ColorBMP(int x, int y, int mem_mode, char format, string filename);        [DllImport("Winppla.dll")]        private static extern int A_Initial_Setting(int Type, string Source);        [DllImport("Winppla.dll")]        private static extern int A_Load_Graphic(int x, int y, string graphic_name);        [DllImport("Winppla.dll")]        private static extern int A_Open_ChineseFont(string path);        [DllImport("Winppla.dll")]        private static extern int A_Print_Form(int width, int height, int copies, int amount, string form_name);        [DllImport("Winppla.dll")]        private static extern int A_Print_Out(int width, int height, int copies, int amount);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Barcode(int x, int y, int ori, char type, int narrow, int width, int height, char mode, int numeric, string data);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Text(int x, int y, int ori, int font, int type, int hor_factor, int ver_factor, char mode, int numeric, string data);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Text_Chinese(int x, int y, int fonttype, string id_name, string data, int mem_mode);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Text_TrueType(int x, int y, int FSize, string FType, int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name, string data, int mem_mode);        [DllImport("Winppla.dll")]        private static extern int A_Prn_Text_TrueType_W(int x, int y, int FHeight, int FWidth, string FType, int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name, string data, int mem_mode);        [DllImport("Winppla.dll")]        private static extern int A_Set_Backfeed(int back);        [DllImport("Winppla.dll")]        private static extern int A_Set_BMPSave(int nSave, string pstrBMPFName);        [DllImport("Winppla.dll")]        private static extern int A_Set_Cutting(int cutting);        [DllImport("Winppla.dll")]        private static extern int A_Set_Darkness(int heat);        [DllImport("Winppla.dll")]        private static extern int A_Set_DebugDialog(int nEnable);        [DllImport("Winppla.dll")]        private static extern int A_Set_Feed(char rate);        [DllImport("Winppla.dll")]        private static extern int A_Set_Form(string formfile, string form_name, int mem_mode);        [DllImport("Winppla.dll")]        private static extern int A_Set_Margin(int position, int margin);        [DllImport("Winppla.dll")]        private static extern int A_Set_Prncomport(int baud, int parity, int data, int stop);        [DllImport("Winppla.dll")]        private static extern int A_Set_Prncomport_PC(int nBaudRate, int nByteSize, int nParity, int nStopBits, int nDsr, int nCts, int nXonXoff);        [DllImport("Winppla.dll")]        private static extern int A_Set_Sensor_Mode(char type, int continuous);        [DllImport("Winppla.dll")]        private static extern int A_Set_Speed(char speed);        [DllImport("Winppla.dll")]        private static extern int A_Set_Syssetting(int transfer, int cut_peel, int length, int zero, int pause);        [DllImport("Winppla.dll")]        private static extern int A_Set_Unit(char unit);        [DllImport("Winppla.dll")]        private static extern int A_Set_Logic(int logic);        [DllImport("Winppla.dll")]        private static extern int A_Set_ProcessDlg(int nShow);        [DllImport("Winppla.dll")]        private static extern int A_Set_LabelVer(int centiInch);        [DllImport("Winppla.dll")]        private static extern int A_GetUSBBufferLen();        [DllImport("Winppla.dll")]        private static extern int A_EnumUSB(byte[] buf);        [DllImport("Winppla.dll")]        private static extern int A_CreateUSBPort(int nPort);        [DllImport("Winppla.dll")]        private static extern int A_CreatePort(int nPortType, int nPort, string filename);         void Cancle_Click(object sender, EventArgs e)        {            this.Close();        }         void Confim_Click(object sender, EventArgs e)        {            int x = 30;            int y = 1;             A_CreatePrn(1, "NULL");            A_Clear_Memory();            A_Set_Darkness(8);            string Barcode = "690000000000";            string MatName = "";            string Contact = "";            string Manufact = "";            string Price = "0.00";             EntityObject eo_Mat = EntityObjectFactory.GetInstance(this.objContext, EntityIDEnum.Material).FindFirst("Number = {0}", Num);            if (eo_Mat != null)            {                Barcode = eo_Mat.GetProperty("Barcode").ToString();                MatName = eo_Mat.GetProperty("Name").ToString();                Contact = eo_Mat.GetProperty("Contact").ToString();                Manufact = eo_Mat.GetProperty("Manufacturers").ToString();                if (Manufact.Length > 6)                {                    Manufact = Manufact.Substring(0, 6);                }                EntityObject eo_Price = EntityObjectFactory.GetInstance(this.objContext, EntityIDEnum.MaterialsPurchasePrice).FindFirst("materialID = {0}", eo_Mat.PrimaryKeyValue);                if (eo_Price != null)                {                    Price = eo_Price.GetProperty("RetailPrice").ToString();                }            }            int LabelCount = Convert.ToInt32(count.VALUE);            int Ys = 0;            System.Math.DivRem(LabelCount, 3, out Ys);            int rowCount = LabelCount / 3;             if (MatName.Length > 11)            {                if (IfUnit.Checked == true)                {                    MatName = MatName.Substring(0, 11);                }                else                {                    MatName = MatName.Substring(0, 12);                }            }            Price = decimal.Round(Convert.ToDecimal(Price), 3).ToString();            string row1 = (IfBarde.Checked == true) ? (Barcode) : ("");            string row2 = ((IfName.Checked == true) ? (MatName) : ("")) + " " + ((IfUnit.Checked == true) ? (Unit) : (""));            string row3 = ((IfMufact.Checked == true) ? (Manufact) : ("")) + " " + ((IfContact.Checked == true) ? (Contact) : (""));             A_Prn_Barcode(x, y + 30, 1, 'e', 1, 1, 30, 'N', 1, Barcode);            A_Prn_Text_TrueType(x, y + 20, 18, "宋体", 1, 700, 0, 0, 0, "AB", row1, 1);            A_Prn_Text_TrueType(x - 10, y + 10, 18, "宋体", 1, 700, 0, 0, 0, "A", row2, 1);            A_Prn_Text_TrueType(x - 10, y, 16, "宋体", 1, 700, 0, 0, 0, "B", row3, 1);             A_Prn_Barcode(x + 130, y + 30, 1, 'e', 1, 1, 30, 'N', 1, Barcode);            A_Prn_Text_TrueType(x + 130, y + 20, 18, "宋体", 1, 700, 0, 0, 0, "AB", row1, 1);            A_Prn_Text_TrueType(x + 120, y + 10, 18, "宋体", 1, 700, 0, 0, 0, "A", row2, 1);            A_Prn_Text_TrueType(x + 120, y, 16, "宋体", 1, 700, 0, 0, 0, "B", row3, 1);             A_Prn_Barcode(x + 265, y + 30, 1, 'e', 1, 1, 30, 'N', 1, Barcode);            A_Prn_Text_TrueType(x + 265, y + 20, 18, "宋体", 1, 700, 0, 0, 0, "AB", row1, 1);            A_Prn_Text_TrueType(x + 255, y + 10, 18, "宋体", 1, 700, 0, 0, 0, "A", row2, 1);            A_Prn_Text_TrueType(x + 255, y, 16, "宋体", 1, 700, 0, 0, 0, "B", row3, 1);             A_Print_Out(1, 1, LabelCount, 1);             A_ClosePrn();            this.Close();        }    }

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除

 


回复:条码打印
dml(游客)发表评论于2010/6/18 10:22:15

        [DllImport("kernel32.dll", CharSet = CharSet.Auto)]        private static extern IntPtr CreateFile(string lpFileName,        int dwDesiredAccess,        int dwShareMode,        int lpSecurityAttributes,        int dwCreationDisposition,        int dwFlagsAndAttributes,        int hTemplateFile);        public void PrintLine(string str)        {           try           {               IntPtr iHandle = CreateFile(PosMain.BoxConnection, 0x40000000, 0, 0, 3, 0, 0);                System.Threading.Thread.CurrentThread.Join(100);                if (iHandle.ToInt32() != -1)                {                    FileStream fs = new FileStream(iHandle,FileAccess.ReadWrite);                    StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("GB2312"));                    sw.WriteLine(str);                    sw.Close();                    fs.Close();                }            }            catch (Exception e)            {                MessageBox.Show(e.ToString());            }       }

 


回复:条码打印
allensmith发表评论于2015/1/22 11:28:10

I want to print barcode in c#,does anyone have any ideas about it? Or any good suggestion? I am totally a green hand on barcode printing field. Any suggestion will be appreciated. Thanks in advance.

 


» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)
 

The Neurotic Fishbowl

.: 公告

fighting for the work!


Bloginess

«November 2025»
1
2345678
9101112131415
16171819202122
23242526272829
30

.: 我的分类(专题)

首页(449)
文字感悟(103)
学习公共库(61)
生活体会(100)
资源收集(14)
.NET-Winform(27)
音乐文字(15)
心情小记(119)
SQL问题解决(10)


In the Bowl

.: 最新日志

C#打印代码
你看到的我是蓝色的
即将逝去的3月
这个假期
两个月过去
表名存在其他表时获取数据
条码打印
Remoting的用法
INI文件用法


.: 最新回复

回复:条码打印
回复:条码打印
回复:即将逝去的3月
回复:cookie对象使用
回复:条码打印
回复:JSP学习(字符串比较)
回复:应收应付核销规则及常见问题(续)
回复:两个月过去
回复:两个月过去


The Fishkeeper
blog名称:栗色?蓝色?
日志总数:449
评论数量:201
留言数量:37
访问次数:2271664
建立时间:2006年5月16日



Text Me

.: 留言板

签写新留言

链接完成
回:loseVC
来喽~
转转......
新年啦
对自己说
祝福
回:佑手
WO


Other Fish in the Sea

.: 链接


loseVC's BLOG
Collapsar_feel
布衣加针
C#and.Net
Kinogam Web




站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.787 second(s), page refreshed 144797068 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号