示例#1
0
        private int PrepareCardText(int nres)
        {
            // drawing routines are followed....
            // draw image to front page
            string strImg;
            IntPtr strImg_ptr;

            SmartComm2.RECT rcDraws;
            IntPtr          rcDraws_ptr;

            // draw text to front page
            string strText;
            IntPtr strText_ptr;
            string strFont;
            IntPtr strFont_ptr;

            strText     = textToPrintOnCard;
            strText_ptr = Marshal.StringToHGlobalUni(strText);
            strFont     = "Tahoma";
            strFont_ptr = Marshal.StringToHGlobalUni(strFont);
            rcDraws_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SmartComm2.RECT)));
            if (nres == SmartComm2.SM_SUCCESS)
            {
                nres = SmartComm2.SmartComm_DrawText((long)hsmartprinterid, System.Convert.ToByte(SmartComm2.PAGE_FRONT), System.Convert.ToByte(SmartComm2.PANEL_BLACK), 90, 480, (long)strFont_ptr, 11, SmartComm2.FONT_BOLD, (long)strText_ptr, (long)rcDraws_ptr);
            }
            Marshal.FreeHGlobal(strText_ptr);
            Marshal.FreeHGlobal(strFont_ptr);
            Marshal.FreeHGlobal(rcDraws_ptr);
            return(nres);
        }