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

📄 diary.cpp

📁 乒乓球俱乐部管理系统
💻 CPP
字号:
// diary.cpp : implementation file
//

#include "stdafx.h"
#include "ppjlb.h"
#include "diary.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Cdiary dialog


Cdiary::Cdiary(CWnd* pParent /*=NULL*/)
	: CDialog(Cdiary::IDD, pParent)
{
	//{{AFX_DATA_INIT(Cdiary)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void Cdiary::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Cdiary)
	DDX_Control(pDX, IDC_EDIT1, m_diary);
	//}}AFX_DATA_MAP
	DDX_Control(pDX, IDCANCEL, m_close);
}


BEGIN_MESSAGE_MAP(Cdiary, CDialog)
	//{{AFX_MSG_MAP(Cdiary)
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Cdiary message handlers

BOOL Cdiary::OnInitDialog() //日志对话框类初始化函数
{
	CDialog::OnInitDialog();
	CBitmap bmp;
	bmp.LoadBitmap(IDB_BITMAP1);
	brush.CreatePatternBrush(&bmp);

	m_close.SetIcon(IDI_ICON12);
	/*CStdioFile   MyFile("test.txt",CFile::modeReadWrite|CFile::modeNoTruncate);     
  CString   buffString;   
  MyFile.ReadString(buffString);//按行读出   
  MyFile.WriteString(buffString);//按行写入   
  MyFile.Close();*/
	CString diary="",str;  //diary用于储存文件中内容,str用于提取一行信息
	CStdioFile cf;  //定义读写文件实例 
	cf.Open("diary.txt",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeRead);
	while(cf.ReadString(str)){//循环读出文件中内容
		diary+=str+"\r\n";
	}
	m_diary.SetWindowText(diary);//显示到静态编辑框中
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

HBRUSH Cdiary::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	pDC->SetBkMode(TRANSPARENT);
	// TODO: Change any attributes of the DC here
	return brush;
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

⌨️ 快捷键说明

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