📄 dianzhendlg.h
字号:
// dianzhenDlg.h : header file
//
#include "FullScreenDlg.h"
#if !defined(AFX_DIANZHENDLG_H__5EA9AD2F_C834_430E_A5DB_6B43620C9319__INCLUDED_)
#define AFX_DIANZHENDLG_H__5EA9AD2F_C834_430E_A5DB_6B43620C9319__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define ROWNUM 16 /*每面每行字符数*/
#define COLNUM 18 /*每面每列字符数*/
#define PAGENUM (ROWNUM*COLNUM) /*每面总字符数*/
#define DZ_NUM 72 /*保存一个点阵字符所需要的字节数量*/
#define X_PAGE_START 35 /*整屏点阵显示的起始X座标*/
#define Y_PAGE_START 30 /*整屏点阵显示的起始Y座标*/
#define MAX_FONT 11 /*字符最大放大倍数*/
#define MIN_FONT 4 /*字符最小放大倍数*/
/*以下四个宏定义来自于打印机驱动程序中的cn_code.c*/
#define FOUR_82_2_POS (long)(4*1260+(0x0eb-0x81)*10)
#define FOUR_82_3_POS (long)(FOUR_82_2_POS+90)
#define FOUR_82_4_POS (long)(FOUR_82_3_POS+90)
#define FOUR_END_POS (long)(FOUR_82_4_POS+90)
/////////////////////////////////////////////////////////////////////////////
// CDianzhenDlg dialog
class CDianzhenDlg : public CDialog
{
/************************************************************************
*****************************成员变量定义处******************************
************************************************************************/
private:
CString m_fileName; //字库文件名字
FILE * m_pFile; //保存打开字库文件的文件指针
CBrush m_dotBrush; //保存用有点颜色建立的画刷
CBrush m_notDotBrush; //保存用无点颜色建立的画刷
COLORREF m_dotColor; //保存有点颜色
COLORREF m_ndotColor; //保存无点颜色
byte m_buf[DZ_NUM]; //用来保存当前所选字符的点阵数据
byte m_destBuf[DZ_NUM]; //用来保存当前所选字符行列转换后的点阵数据
byte m_bufArr[PAGENUM][DZ_NUM]; //保存一页字符
int m_dotSize; //点大小
int X_START; //显示单个点阵字符时的x座标
int Y_START; //显示单个点阵字符时的y座标
int m_maxPage; //最大页数
int m_maxIndex; //最后字符索引
int m_xpos; //用来保存当前选择字符的x座标
int m_ypos; //用来保存当前选择字符的y座标
CFullScreenDlg fsDlg; //用来全屏显示点阵字符的对话框
// Construction
public:
CDianzhenDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDianzhenDlg)
enum { IDD = IDD_DIANZHEN_DIALOG };
CSliderCtrl m_numEnlarge; //字符显示大小控制滑块
CEdit m_dzHexH; //用来显示当前所选字符的16进制行扫描点阵方式
CEdit m_dzHexV; //用来显示当前所选字符的16进制列扫描点阵方式
int m_input; //用来保存当前所选字符索引
CString m_code; //获取用户输入
int m_inputKind; //保存输入方式
int m_numPage; //保存当前页码
int m_codeType; //保存当前编码方式
int m_scanType; //保存当前扫描方式
int m_dotType; //保存当前绘制的点的类型
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDianzhenDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CDianzhenDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnBtnFirst();
afx_msg void OnBtnLast();
afx_msg void OnBtnPrevious();
afx_msg void OnBtnNext();
afx_msg void OnBtnSelect2();
afx_msg void OnRadio1();
afx_msg void OnRadio2();
afx_msg void OnRadio3();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnBtnDcolor();
afx_msg void OnBtnNdcolor();
afx_msg void OnBtnFile();
afx_msg void OnBtnFp();
afx_msg void OnBtnLp();
afx_msg void OnBtnPp();
afx_msg void OnBtnNp();
afx_msg void OnBtnPage();
afx_msg void OnDestroy();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCustomdrawSlidEnlarge(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnBtnFscreen();
afx_msg void OnColscan();
afx_msg void OnRowscan();
afx_msg void OnDotCircle();
afx_msg void OnDotSquare();
afx_msg void OnGb();
afx_msg void OnBig();
afx_msg void OnUnicode();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
/************************************************************************
*****************************供外部类调用的公共函数**********************
************************************************************************/
int getIntByChar(char c); //将0-9,A-F字符转变为相应的10进制整数
void DoPrePage(); //前一页
void DoNextPage(); //后一页
void DoFirstPage(); //首页
void DoLastPage(); //末页
void DoBtnPrevious(); //向左箭头(前一个字)
void DoBtnNext(); //向右箭头(后一个字)
void DoBtnUp(); //向上箭头(上一行正上方的字)
void DoBtnDown(); //向下箭箭(下一行正下方的字)
void DoSlidEnlarge(bool isLarge); //用'+','-'控制点字符放大与缩小所调用的函数
/*****************************************************************
description:根据字符索引选择当前字符并放大显示
firstColor:字符前景颜色
secondColor:字符背景颜色
******************************************************************/
void SelByIndex(COLORREF &firstColor,COLORREF &secondColor);
/*****************************************************************
description:将以字节保存的点阵字符转变为16进制的方式保存
buf:输入点阵
str:保存点阵的16进制格式形式
******************************************************************/
void GetStr16FromByteArr(byte buf[DZ_NUM],CString& str);
/*****************************************************************
description:将字符点阵扫描方式进行行列转换
srcBuf:输入点阵
destBuf:输出点阵
******************************************************************/
void FromColtoRow(const byte *srcBuf,byte *destBuf);
/*****************************************************************
description:由字符索引来获取字符编码(此函数已不用)
index:字符索引
buf:字符编码
******************************************************************/
void GetCodeByIndex(int index,char* buf);
/*****************************************************************
description:在页面上重绘一个字符
x:起始x座标
y:起始y座标
buf:存放点阵的字节数组
dc:绘图设备
len:给制点的大小
dotCol:有点的颜色
notDotCol:没有点的颜色
isDolScan:行列扫描方式
******************************************************************/
void SmallFontDislpay(int x,int y,byte* buf,CDC *dc,
int len,COLORREF& dotCol,COLORREF& notDotCol,int isColScan = 0);
/*****************************************************************
description:在点阵显示区打印一个字
x:起始x座标
y:起始y座标
buf:存放点阵的字节数组
dc:绘图设备
len:给制点的大小
dotBrush:有点的颜色所构建出来的画刷
noDotBrush:无点的颜色所构建出来的画刷
isDolScan:行列扫描方式
******************************************************************/
void FontDisPlay(int x,int y,byte *buf,CDC *dc,
int len,CBrush& dotBrush,CBrush& noDotBrush,int isColScan = 0);
/*****************************************************************
description:显示一页,此函数调用SmallFontDislpay来绘制一个个字符
x:起始x座标
y:起始y座标
buf:存放点阵的字节数组
dc:绘图设备
len:给制点的大小
dotCol:有点的颜色
notDotCol:没有点的颜色
isDolScan:行列扫描方式
******************************************************************/
void FontArrDisPlay(int x,int y,byte bufArr[PAGENUM][DZ_NUM],CDC *dc,
int len,COLORREF& dotCol,COLORREF& notDotCol,int isColScan = 0);
/*****************************************************************
description:根据页码显示一页,具体显示方式由FontArrDisplay来实现
pageIndex:输入页面
******************************************************************/
void PrintPage(int pageIndex);
/*****************************************************************
description:在(left,top,right,bottom)所指定的区域根据dotType类型绘制一个相应的图形
dc:绘图设备
left,top,right,bottom:指定绘制区域
dotType:绘制的图形类型
******************************************************************/
void DrawDot(CDC *pdc,int left,int top,int right,int bottom,int dotType);
/*****************************************************************
description:四字节字符偏移量的计算方法,此函数来自于打印机驱动程序
c1,c2,c3,c4:汉字的四个字节
return:字符在字库的索引位置
******************************************************************/
unsigned short FourBytePro(unsigned short c1,unsigned short c2,unsigned short c3,unsigned short c4);
//重写基类的两个虚函数,以免按下回车与ESC键程序自动退出
void OnOK();
void OnCancel();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIANZHENDLG_H__5EA9AD2F_C834_430E_A5DB_6B43620C9319__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -