⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.h

📁 《Visual C++ Bible》或者说是《Visual C++ 宝典》的对应的源码文件
💻 H
字号:
// mainfrm.h : interface of the DMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#include <afxtempl.h> // Connect to CArray template.

// Structure to track lines in text file.
class STRING
{
  public:
    LPTSTR pText;
    int    ccLen;
};

// This declaration uses the CArray template 
// to provide a dynamic array of STRING records.
class StringArray : public CArray <STRING, STRING &>
{
  public:
    StringArray() {}
    STRING& operator=(STRING & s)
                       {m_pData->pText = s.pText;
                        m_pData->ccLen = s.ccLen;
                        return *m_pData;}
};

const int g_nTabCount=25;
const int g_nTabStop=4;

class DMainFrame : public CFrameWnd
{
public:
	DMainFrame();
protected: // create from serialization only
	DECLARE_DYNCREATE(DMainFrame)

// Attributes
public:
    BOOL          d_bTabs;        // Respect tabs or not.
    CFileDialog * d_pOpenFile;    // Ptr to OpenFile dialog.
    CFontDialog * d_pSetFont;     // Ptr to Font Picker dialog.
    CFont  *      d_pFont;        // Ptr to CFont object.
    COLORREF      d_crForeground; // Foreground text color.
    COLORREF      d_crBackground; // Background text color.
    LOGFONT       d_lf;           // Current logical font.
    LPINT         d_pnTabs;       // Array of tab settings.
    LPTSTR        d_lpTextBuffer; // Ptr to text buffer.
    DWORD         d_dwFileLength; // File length.
    StringArray   d_saTextInfo;   // Array of string info.
    int           d_cLines;       // Count of lines in text.
    int           d_cyLineHeight; // Height of one line of text.
    int           d_clHeight;     // Window height line count.
    int           d_iTopLine;     // Index of top-most line.
    int           d_cyClient;     // Window client area height.
    int           d_cxLeftMargin; // Margin to left of text.

// Operations
public:
    void BuildStringArray();
    BOOL CreateNewFont();
    void ResetScrollValues();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(DMainFrame)
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~DMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

// Generated message map functions
protected:
	//{{AFX_MSG(DMainFrame)
	afx_msg void CmdFileOpen();
	afx_msg void CmdFormatFont();
	afx_msg void CmdFormatTabs();
	afx_msg void UpdFormatTabs(CCmdUI* pCmdUI);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnPaint();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnWinIniChange(LPCTSTR lpszSection);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -