📄 generatorview.h
字号:
/******************************************************************************
* 文件名:GeneratorView.h
* 功能 :条形码打印
* Modified by PRTsinghua@hotmail.com
******************************************************************************/
#if !defined(AFX_GENERATORVIEW_H_INCLUDED_)
#define AFX_GENERATORVIEW_H_INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
class CGeneratorView : public CView
{
protected:
CGeneratorView();
DECLARE_DYNCREATE(CGeneratorView)
public:
CGeneratorDoc* GetDocument();
public:
public:
virtual void OnDraw(CDC* pDC);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
public:
// 画数字
void DrawNumber(CDC *ptDC);
// 数字转换成字符
void ToChar(int no,char &c);
// 画条形码结束的部分
void DrawEnd(CDC *ptDC);
// 画条形码的右半部
void DrawRight(CDC *ptDC);
// 画条形码中间部分
void DrawMiddle(CDC *ptDC);
// 画条形码的左半部
void DrawLeft(CDC *ptDC);
// 画黑色部分
void DrawOne(CDC *ptDC,CPoint point,BOOL b_long);
// 画空白部分
void DrawZero(CDC *ptDC,CPoint point);
// 画条形码的开始部分
void DrawStart(CDC *ptDC);
// 检查校验码
int CheckBit();
// 建立第二个表
void BldSecondTable();
// 建立第一个表
void BldFirstTable();
virtual ~CGeneratorView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
private:
CBitmap *pBitmap;
int picWidth; // 图像宽度
int picHeight; // 图像高度
int lineWidth; // 线的宽度
int shortLine; // 短线长度
int longLine; // 长线长度
BOOL m_bModified; // 脏标记
int code[13]; // 条形码数字数组
CMapStringToString coderule;
CString firstcode[10];
protected:
CDC *dcMem;
afx_msg void OnEditGive();
afx_msg void OnFileSave();
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG
inline CGeneratorDoc* CGeneratorView::GetDocument()
{ return (CGeneratorDoc*)m_pDocument; }
#endif
#endif // !defined(AFX_GENERATORVIEW_H_INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -