// StudentSystemView.cpp: CStudentSystemView 类的实现
//
#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "StudentSystem.h"
#endif
#include "StudentSystemDoc.h"
#include "StudentSystemView.h"
#include "DataChange.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CStudentSystemView
IMPLEMENT_DYNCREATE(CStudentSystemView, CScrollView)
BEGIN_MESSAGE_MAP(CStudentSystemView, CScrollView)
// 标准打印命令
ON_COMMAND(ID_FILE_PRINT, &CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CScrollView::OnFilePrintPreview)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
ON_COMMAND(ID_DELETE, &CStudentSystemView::OnDelete)
ON_COMMAND(ID_CHANGE, &CStudentSystemView::OnChange)
END_MESSAGE_MAP()
// CStudentSystemView 构造/析构
CStudentSystemView::CStudentSystemView() noexcept
{
// TODO: 在此处添加构造代码
//MessageBox(TEXT("子视图打开"));
}
CStudentSystemView::~CStudentSystemView()
{
}
BOOL CStudentSystemView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
return CScrollView::PreCreateWindow(cs);
}
// CStudentSystemView 绘图
void CStudentSystemView::OnDraw(CDC* pDC)
{
CStudentSystemDoc* pDoc = GetDocument();//从这里得到了文件
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: 在此处为本机数据添加绘制代码
//这里是VIEW中的绘制数据的函数体
//GetDocument()可以获得相应的文档对象
//pDC->TextOut(0, 0, TEXT("hello"));//可以在屏幕上显示出固定的文字
//CString out;
//out.Format(_T("%s"), (std::to_string(current_student)).c_str());
//MessageBox(out);
CFont *old_font = (CFont*)pDC->SelectStockObject(ANSI_FIXED_FONT);
for (int i(0), len(pDoc->GetNumOfStudent()); i < len; ++i)
{
CString output;
//output.Format("%s", "hello");
//output.Format(200, "%s%s%s%s", "hello", "you", "son", "shit");
//output = "hello";
output.Format(_T("%-20.20s%-20.20s%-5.5s%-5.5s"),
pDoc->data[i].name, pDoc->data[i].num, pDoc->data[i].sex, pDoc->data[i].age);
if (i != current_student)
{
pDC->SetTextColor(RGB(0, 0, 0));
pDC->SetBkColor(RGB(255, 255, 255));
}
else
{
pDC->SetTextColor(RGB(255, 255, 255));
pDC->SetBkColor(RGB(0, 0, 0));
}
pDC->TextOut(0, i * 20, output);
}
pDC->SelectObject(old_font);
}
// CStudentSystemView 打印
BOOL CStudentSystemView::OnPreparePrinting(CPrintInfo* pInfo)
{
// 默认准备
return DoPreparePrinting(pInfo);
}
void CStudentSystemView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加额外的打印前进行的初始化过程
}
void CStudentSystemView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加打印后进行的清理过程
}
// CStudentSystemView 诊断
#ifdef _DEBUG
void CStudentSystemView::AssertValid() const
{
CScrollView::AssertValid();
}
void CStudentSystemView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CStudentSystemDoc* CStudentSystemView::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CStudentSystemDoc)));
return (CStudentSystemDoc*)m_pDocument;
}
#endif //_DEBUG
// CStudentSystemView 消息处理程序
void CStudentSystemView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CScrollView::OnLButtonDown(nFlags, point);
CClientDC dc(this);
OnPrepareDC(&dc, NULL);
dc.DPtoLP(&point);//物理坐标转为逻辑坐标
current_student = point.y / 20;
//OnUpdate;
//OnDraw(WM_PAINT);
//RedrawWindow();
//MessageBox("OUT");
Invalidate();
}
void CStudentSystemView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CScrollView::OnLButtonDblClk(nFlags, point);
current_student = point.y / 20;
CStudentSystemDoc* pDoc = GetDocument();//从这里得到了文件
ASSERT_VALID(pDoc);
if (!pDoc)
return;
if (current_student < pDoc->data.size() && current_student >= 0)
{
DataChange dlg;
//MessageBox("HOW");
dlg.name = pDoc->data[current_student]�
没有合适的资源?快使用搜索试试~ 我知道了~
人工智能-项目实践-信息管理系统-基于MFC实现的简易的多文件学生信息管理系统
共89个文件
obj:20个
tlog:18个
h:12个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 200 浏览量
2024-03-10
22:31:59
上传
评论
收藏 8.88MB ZIP 举报
温馨提示
基于MFC实现的简易的多文件学生信息管理系统
资源推荐
资源详情
资源评论
收起资源包目录
NJU-StudentSystem-MFC-master.zip (89个子文件)
NJU-StudentSystem-MFC-master
StudentSystem
StudentSystem.sln 1KB
res
StudentSystem.ico 66KB
Toolbar.bmp 1KB
StudentSystem.rc2 682B
StudentSystemDoc.ico 5KB
StudentSystem
stdafx.h 3KB
StudentSystem.aps 126KB
StudentSystem.h 1KB
StudentSystem.cpp 9KB
File.h 65B
CDataInsertDlg.h 2KB
StudentSystem2 38B
File.cpp 89B
CDlgHowToPlay.h 882B
resource.h 5KB
StudentSystemView.h 3KB
StudentSystemDoc.h 3KB
MainFrm.cpp 4KB
ChildFrm.cpp 2KB
StudentSystem.vcxproj.filters 3KB
StudentSystemView.cpp 14KB
StudentSystem1 67B
res
StudentSystem.ico 66KB
Toolbar.bmp 1KB
StudentSystem.rc2 682B
StudentSystemDoc.ico 5KB
DataChange.h 1KB
DataChange.cpp 4KB
StudentSystem.rc 33KB
MainFrm.h 1KB
ChildFrm.h 1KB
test1 165B
StudentSystem.vcxproj.user 236B
StudentSystem.vcxproj 11KB
test 165B
CDataInsertDlg.cpp 4KB
CDlgHowToPlay.cpp 1KB
Debug
vc141.pdb 9.21MB
StudentSystemDoc.obj 733KB
StudentSystemView.obj 224KB
StudentSystem.res 93KB
StudentSystem.obj 91KB
vc141.idb 1.42MB
StudentSystem.log 503B
CDataInsertDlg.obj 127KB
StudentSystem.tlog
CL.write.1.tlog 31KB
rc.command.1.tlog 458B
rc.write.1.tlog 334B
rc.read.1.tlog 10KB
CL.command.1.tlog 8KB
link.command.1.tlog 3KB
StudentSystem.lastbuildstate 252B
link.read.1.tlog 10KB
link.write.1.tlog 2KB
CL.read.1.tlog 143KB
DataChange.obj 126KB
CDlgHowToPlay.obj 27KB
File.obj 9KB
stdafx.obj 988KB
ChildFrm.obj 32KB
MainFrm.obj 79KB
stdafx.cpp 236B
targetver.h 370B
StudentSystemDoc.cpp 14KB
Debug
vc141.pdb 9.26MB
StudentSystemDoc.obj 733KB
StudentSystemView.obj 237KB
StudentSystem.res 93KB
StudentSystem.obj 91KB
vc141.idb 1.42MB
StudentSystem.log 156B
CDataInsertDlg.obj 127KB
StudentSystem.tlog
CL.write.1.tlog 31KB
rc.command.1.tlog 458B
rc.write.1.tlog 334B
rc.read.1.tlog 10KB
CL.command.1.tlog 8KB
link.command.1.tlog 3KB
StudentSystem.lastbuildstate 252B
link.read.1.tlog 10KB
link.write.1.tlog 2KB
CL.read.1.tlog 143KB
DataChange.obj 128KB
CDlgHowToPlay.obj 27KB
StudentSystem.exe 8.93MB
File.obj 9KB
stdafx.obj 988KB
ChildFrm.obj 32KB
MainFrm.obj 79KB
共 89 条
- 1
资源评论
博士僧小星
- 粉丝: 1924
- 资源: 5885
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功