EditWnd.h
上传用户:gtl066
上传日期:2007-06-15
资源大小:33k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Visual C++

  1. #if !defined(AFX_EDITWND_H__46012F8D_540A_43AF_9FF1_C1C8F27F2627__INCLUDED_)
  2. #define AFX_EDITWND_H__46012F8D_540A_43AF_9FF1_C1C8F27F2627__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // EditWnd.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CEditWnd window
  10. class CEditWnd : public CWnd
  11. {
  12. // Construction
  13. public:
  14. CEditWnd();
  15. DECLARE_DYNCREATE( CEditWnd )
  16. // Attributes
  17. public:
  18. // Operations
  19. public:
  20. void GetString(CString &strWnd);
  21. // Overrides
  22. // ClassWizard generated virtual function overrides
  23. //{{AFX_VIRTUAL(CEditWnd)
  24. public:
  25. virtual BOOL PreTranslateMessage(MSG* pMsg);
  26. protected:
  27. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  28. //}}AFX_VIRTUAL
  29. // Implementation
  30. public:
  31. virtual ~CEditWnd();
  32. // Generated message map functions
  33. protected:
  34. //{{AFX_MSG(CEditWnd)
  35. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  36. afx_msg void OnPaint();
  37. afx_msg void OnSetFocus(CWnd* pOldWnd);
  38. afx_msg void OnKillFocus(CWnd* pNewWnd);
  39. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  40. afx_msg UINT OnGetDlgCode();
  41. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  42. afx_msg void OnSize(UINT nType, int cx, int cy);
  43. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  44. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  45. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  46. //}}AFX_MSG
  47. DECLARE_MESSAGE_MAP()
  48. private:
  49. private:
  50. int PosFromChar(UINT nChar); // 通过指定的字符获得其x轴的位置
  51. int CharFromPos(int nPosX); // 通过给定的x轴的位置获得相应的字符
  52. void CutString(); // 剪切字符串
  53. void PasteString(); // 粘贴字符串
  54. void CopyString(); // 拷贝字符串
  55. void MakeBKGround(CDC *pDC, COLORREF clrBegin, COLORREF clrEnd, CRect rect); // 生成窗口背景
  56. CString m_strEdit; // 当前包含的文本。
  57. CString m_strSelect; // 当前选择的文本。
  58. CPoint m_ptCursor; // 当前光标的位置。
  59. CPoint m_ptTxtBegin; // 文本的起始位置。
  60. CPoint m_ptFirst; // 鼠标左键按下时的第一点位置。
  61. CPoint m_ptSecond; // 鼠标当前的位置。
  62. int m_nCharPos; // 当前光标处于第几个字符的后面,从0开始计数。
  63. int m_nShowChar; // 在编辑框中第一个显示的字符,从0开始计数。
  64. int m_nMaxShowChars; // 在编辑框中一次最多显示的字符数量 。
  65. int m_nSelectBegin; // 选择的字符的起始位置。
  66. int m_nSelectEnd; // 选择的字符的终止位置。
  67. CBitmap m_BmpBK; // 背景图片。
  68. CFont m_TxtFont; // 文本的字体。
  69. TEXTMETRIC m_tm; // 文本字体的信息。
  70. CRect m_rcWnd; // 窗口的大小。
  71. bool m_bLBtDown; // 鼠标左键按下。
  72. int m_nShiftBegin; // shift键第一次时光标所在的字符的位置。
  73. };
  74. /////////////////////////////////////////////////////////////////////////////
  75. //{{AFX_INSERT_LOCATION}}
  76. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  77. #endif // !defined(AFX_EDITWND_H__46012F8D_540A_43AF_9FF1_C1C8F27F2627__INCLUDED_)