📄 mweditctl.h
字号:
#if !defined(AFX_MWEDITCTL_H__54717213_4C3B_11D5_8DC4_0080C8E1F352__INCLUDED_)
#define AFX_MWEDITCTL_H__54717213_4C3B_11D5_8DC4_0080C8E1F352__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MWEditCtl.h : Declaration of the CMWEditCtrl ActiveX Control class.
/////////////////////////////////////////////////////////////////////////////
// CMWEditCtrl : See MWEditCtl.cpp for implementation.
class CMWEditCtrl : public COleControl
{
DECLARE_DYNCREATE(CMWEditCtrl)
// Constructor
public:
CMWEditCtrl();
typedef struct Caret{
POINT CaretPos;//光标坐标
int CharCount;//当前列字(字符)个数
long SCreenLine;//光标在当前屏幕列数
long GeneralLine;//在总列的位置
long GeneralBufPos;//当前光标在总内存中的位置
}Caret;
Caret curCaret;
Caret storeCaret;
Caret zero;
CString storeStr;
typedef struct General{
int ColumnCount[100];//总列中每一列字符个数
long ColumnPosit[100];//总列中每一列最后一个字符末位置
}General;
General curGeneral;
typedef struct Transmis{
Caret FirstCaret;
Caret LastCaret;
CString Str;
}Transmis;
Transmis transmis;
Transmis block;
CString m_cstrCaption;
short sControl;
void CopyDataToClipboard(void);
void PrepareDataForTransfer(COleDataSource*opOleDataSource);
void GetDataFromClipboard(void);
BOOL GetDataFromTransfer(COleDataObject * opOleDataObject);
UINT m_uiCustomFormat;
bool blockflag;
bool clipflag;
bool allflag;
Caret firstcurCaret;//鼠标拖动时的首位置
bool firstflag;//是否记录了首位置1:记录 0:未记录
int backcount;//回溯光标前一个字
long DealGenPos;//记录删除,插入后重画部分的首位置
Caret redrawcaret;//记录重画时光标位置
int leftcharcount;//记录本列光标以下字符个数
Caret GetCharPositFromCount;
CFont MyFont;//创字体
CMenu MyPopMenu;
// CScrollBar MyBar;
long yy;
bool WindowChangFlag;
char ch[2];//接受临时字符
CString SubStr;//接受临时字符串
bool flag;//Onchar()中表示ch[2]正在接受哪个字符位
bool thisone;//辅助ch[2]接受汉字
bool Select;
bool Insert;//开关:插入《-----》替换
bool font;//开关:蒙文《-----》英文
CString Enter;
int MaxLine;
int SFLisGL;//Screen First Line is the Line of General;
long allLine;//删增后第一个不需刷新字符位置
CString m_bufferStrCopy;
Caret curCaretCopy;
int finishflag;
Caret p1;
LPRECT lpRect;
CRect Rect;
//screen
long maxscreenline;
void Up();
void Down();
void Left();
void Right();
void End();
void Home();
void Move(int);//
void Pageup();
void Pagedown();
void Delete();
void Backup();
//void Insert();
//void Replace();
void SubRePaint(CMWEditCtrl::Caret,CString);
void SubRePaintb(CMWEditCtrl::Caret,CString);
void SubRePaintc(CMWEditCtrl::Caret caret,CString str);
bool Judge(CMWEditCtrl::Caret,CString);//是假,说明不全刷新
bool Judge2(CMWEditCtrl::Caret);
bool Before(POINT,POINT);
bool virSubrepaint(CMWEditCtrl::Caret,CString,long);
void GetCharPosFromCount(long);
void ChangeBackColor(CMWEditCtrl::Caret,CMWEditCtrl::Caret,COLORREF);
//用指定色col在两坐标将间作背景,并打出前景,两坐标有前后顺序
//从字符在m_bufferStr中的位置得出其屏幕位置,存在GetCharPositFromCountGetCharPositFromCount中
bool JudgeEdit(CMWEditCtrl::Caret);
long GetStrWid(CString);
long GetStrWidH(CString);
long Forward(CString);
long ForwardM(CString);
long Backward(long);
long BackwardM(long);
void BackColor(POINT,POINT,COLORREF);
void mytextout(CMWEditCtrl::Caret,CString);
void mystrout(CMWEditCtrl::Caret,int);//输出无回车的一个字符串
int Test(CString);
void TestInt(int,CString);
void Font(long,CString);
bool MW(CString);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMWEditCtrl)
public:
virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
virtual void DoPropExchange(CPropExchange* pPX);
virtual void OnResetState();
virtual DWORD GetControlFlags();
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
protected:
~CMWEditCtrl();
DECLARE_OLECREATE_EX(CMWEditCtrl) // Class factory and guid
DECLARE_OLETYPELIB(CMWEditCtrl) // GetTypeInfo
DECLARE_PROPPAGEIDS(CMWEditCtrl) // Property page IDs
DECLARE_OLECTLTYPE(CMWEditCtrl) // Type name and misc status
// Message maps
//{{AFX_MSG(CMWEditCtrl)
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnPaint();
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnCopy();
afx_msg void OnCut();
afx_msg void OnDelete();
afx_msg void OnPaste();
afx_msg void OnUndo();
afx_msg void OnSelectall();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnUpdateCopy(CCmdUI* pCmdUI);
afx_msg void OnUpdateCut(CCmdUI* pCmdUI);
afx_msg void OnUpdateDelete(CCmdUI* pCmdUI);
afx_msg void OnUpdatePaste(CCmdUI* pCmdUI);
afx_msg void OnUpdateSelectall(CCmdUI* pCmdUI);
afx_msg void OnUpdateUndo(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Dispatch maps
//{{AFX_DISPATCH(CMWEditCtrl)
CString m_bufferStr;
afx_msg void OnBufferStrChanged();
long m_initialsizecx;
afx_msg void OnInitialsizecxChanged();
long m_initialsizecy;
afx_msg void OnInitialsizecyChanged();
long m_fontWeight;
afx_msg void OnFontWeightChanged();
long m_fontHeight;
afx_msg void OnFontHeightChanged();
long m_top;
afx_msg void OnTopChanged();
long m_bottom;
afx_msg void OnBottomChanged();
long m_left;
afx_msg void OnLeftChanged();
long m_right;
afx_msg void OnRightChanged();
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
afx_msg void AboutBox();
// Event maps
//{{AFX_EVENT(CMWEditCtrl)
//}}AFX_EVENT
DECLARE_EVENT_MAP()
// Dispatch and event IDs
public:
enum {
//{{AFX_DISP_ID(CMWEditCtrl)
dispidBufferStr = 1L,
dispidInitialsizecx = 2L,
dispidInitialsizecy = 3L,
dispidFontWeight = 4L,
dispidFontHeight = 5L,
dispidTop = 6L,
dispidBottom = 7L,
dispidLeft = 8L,
dispidRight = 9L,
//}}AFX_DISP_ID
};
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MWEDITCTL_H__54717213_4C3B_11D5_8DC4_0080C8E1F352__INCLUDED)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -