///************************************************************************/ /* Copyright (C), 2016-2020, [IT], 保留所有权利; /* 模 块 名:; /* 描 述:; /* /* 版 本:[V]; /* 作 者:[IT]; /* 日 期:[4/24/2016]; /* /* /* 注 意:; /* /* 修改记录:[IT]; /* 修改日期:; /* 修改版本:; /* 修改内容:; /************************************************************************/ #ifndef __DRAW_BAR_CODE__ #define __DRAW_BAR_CODE__ #pragma once namespace DrawBarCodes { struct IntString { int ch; char*psz; }; class CBarCodeBase { protected: BYTE m_byBuffer[4096]; int m_nBufferLen; int m_nRatio; struct _INPUTSTR_ { int nChCount; // 输入字符数; CHAR *pInputStr; // 输入的字符串; }; public: CBarCodeBase(); ~CBarCodeBase(); void operator=(const CBarCodeBase& bc); void Clear(); int GetEncodeLength() const; int GetBufferLength() const; const BYTE& GetAt(const int& nIndex) const; int GetRatio() const; int SetRatio(const int& nRatio); void DrawBarCode(IN HDC hDC, IN int nStartX, IN int nStartY, IN int nBarHeight, IN int nBarHeight2, IN const COLORREF clrBar, IN const COLORREF clrSpace, IN const int nPenWidth); }; ////////////////////////////////////////////////////////////////////////// class CBarCode39:public CBarCodeBase { public: CBarCode39(); ~CBarCode39(); BOOL EnCode39(IN LPCTSTR lpszCodeIn); void Draw39(IN HDC hDC, IN int nStartX, IN int nStartY, IN int nBarHeight, IN int nBarHeight2, IN const COLORREF clrBar, IN const COLORREF clrSpace, IN const int nPenWidth); protected: private: BYTE *GetNarrowWideBarSpace39(IN CHAR ch, IN BYTE* pb); }; class CBarCode93:public CBarCodeBase { public: CBarCode93(); ~CBarCode93(); BOOL EnCode93(IN LPCTSTR lpszCodeIn); void Draw93(IN HDC hDC, IN int nStartX, IN int nStartY, IN int nBarHeight, IN int nBarHeight2, IN const COLORREF clrBar, IN const COLORREF clrSpace, IN const int nPenWidth); protected: private: BYTE *GetBarSpace93(IN BYTE* pb, IN int ch); BYTE *GetCheckDigits(IN BYTE* bp, IN const char *&pszCode); BOOL AscIItoCode93Sequence(IN int nValue, IN int& nFirst, IN int& nSecond); }; class CBarCodeI2of5:public CBarCodeBase { public: protected: private: }; class CBarCode128:public CBarCodeBase { public: protected: private: }; class CBarCodeEan13:public CBarCodeBase { public: protected: private: }; }; #endif