asp.net(C#)生成Code39条形码实例 条码枪可以扫描出(2)

public enum Code39Model
        {
            /// <summary>
            /// 基本类别 1234567890ABC
            /// </summary>
            Code39Normal,
            /// <summary>
            /// 全ASCII方式 +A+B 来表示小写
            /// </summary>
            Code39FullAscII
        }
        /// <summary>
        /// 获得条码图形
        /// </summary>
        /// <param>文字信息</param>
        /// <param>类别</param>
        /// <param>是否增加前后*号</param>
        /// <returns>图形</returns>
        public Bitmap GetCodeImage(string p_Text, Code39Model p_Model, bool p_StarChar)
        {
            string _ValueText = "";
            string _CodeText = "";
            char[] _ValueChar = null;
            switch (p_Model)
            {
                case Code39Model.Code39Normal:
                    _ValueText = p_Text.ToUpper();
                    break;
                default:
                    _ValueChar = p_Text.ToCharArray();
                    for (int i = 0; i != _ValueChar.Length; i++)
                    {
                        if ((int)_ValueChar[i] >= 97 && (int)_ValueChar[i] <= 122)
                        {
                            _ValueText += "+" + _ValueChar[i].ToString().ToUpper();

}
                        else
                        {
                            _ValueText += _ValueChar[i].ToString();
                        }
                    }
                    break;
            }

_ValueChar = _ValueText.ToCharArray();

if (p_StarChar == true) _CodeText += m_Code39["*"];

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzswj.html