📄 extrichedit.h
字号:
#if !defined(AFX_EXTRICHEDIT_H__0DEFA623_7B03_4B00_91F9_079A4955A1A3__INCLUDED_)
#define AFX_EXTRICHEDIT_H__0DEFA623_7B03_4B00_91F9_079A4955A1A3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ExtRichEdit.h : header file
//
using namespace ImageOleLib;
class _AFX_RICHEDITEX_STATE
{
public:
_AFX_RICHEDITEX_STATE();
virtual ~_AFX_RICHEDITEX_STATE();
HINSTANCE m_hInstRichEdit20 ;
};
/////////////////////////////////////////////////////////////////////////////
#define FACE_COUNT 2
// CExtRichEdit window
#include "popup_menu.h"
#include <vector>
using namespace std;
struct FacePosition
{
int nPos; //要插入的位置 既它前面有多少字符 picture看做是一个字符
int nFaceIndex; //要插入的图象的在上面数组中IDBmp的index
int facecount; //第几个图片文件 gif 从0开始
char filename[40]; //文件名
};
class CExtRichEdit : public CRichEditCtrl
{
// Construction
public:
CExtRichEdit();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExtRichEdit)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
public:
virtual BOOL Create( DWORD in_dwStyle, const RECT& in_rcRect, CWnd* in_pParentWnd, UINT in_nID );
virtual BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, LPVOID lpParam /* = NULL */);
//}}AFX_VIRTUAL
// Implementation
public:
void InsertFace( CString strPicPath ,int faceindex = 0);
void InsertFace(int faceindex);
virtual ~CExtRichEdit();
void InitSettings();
void InsertText(CString &str,long InsertP = 0); //
int GetEditText(CString &str,bool Sel = false); //获取当前richedit的字符串 表情文件以转义字符表示 其他文件以#+id转义 表示
int DelEditText(CString &str,bool Sel = false);
int GetFaceCount(long InsertP);
int GetBmpCount(long InsertP);
int GetFrontText(long InsertP,int &facecount,int &bmpcount);
void copyfile( );
private:
int copy_data(bool del = false); //拷贝
void paste_data(); //粘贴
void cut_data(); //剪切
void delet_data(); //删除选择的内容
int GetFaceName(CString &filename); //根据表情的转意字符串获取表情文件的index
void InitFaceStr(); //初始化表情文件转义字符串
void UpDataFace(int beg,int end,int facecount,int nPos,bool add); //更新vecFace
// Generated message map functions
protected:
//{{AFX_MSG(CExtRichEdit)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnHscroll();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CString edittext;
int m_facecount;
int m_bmpcount;
vector <FacePosition> vecFace; //vecFace[0]表示第一个表情的位置和型号、vecFace[1]表示第二个表情的位置和型号
vector <FacePosition> showFace;
vector <FacePosition> vecbmp;
char facestr[FACE_COUNT][4];
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXTRICHEDIT_H__0DEFA623_7B03_4B00_91F9_079A4955A1A3__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -