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

📄 777view.cpp

📁 英文字典数据库系统
💻 CPP
字号:
// 777View.cpp : implementation of the CMy777View class
//

#include "stdafx.h"
#include "777.h"

#include "777Set.h"
#include "777Doc.h"
#include "777View.h"
#include "EditDialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMy777View

IMPLEMENT_DYNCREATE(CMy777View, CDaoRecordView)

BEGIN_MESSAGE_MAP(CMy777View, CDaoRecordView)
	//{{AFX_MSG_MAP(CMy777View)
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_EDIT, OnEdit)
	ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CDaoRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CDaoRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CDaoRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMy777View construction/destruction

CMy777View::CMy777View()
	: CDaoRecordView(CMy777View::IDD)
{
	//{{AFX_DATA_INIT(CMy777View)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CMy777View::~CMy777View()
{
}

void CMy777View::DoDataExchange(CDataExchange* pDX)
{
	CDaoRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMy777View)
	DDX_Control(pDX, IDC_LIST1, m_ListCtrl);
	//}}AFX_DATA_MAP
}

BOOL CMy777View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CDaoRecordView::PreCreateWindow(cs);
}

void CMy777View::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_my777Set;
//	CRecordView::OnInitialUpdate();
	CDaoRecordView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();
	//创刷子用来设置界面背景色
    m_Brush=CreateSolidBrush(RGB(30,180,180));
//设表格表题和列的宽度
	m_ListCtrl.SetBkColor(RGB(240,247,233));
	m_ListCtrl.SetTextBkColor(RGB(240,247,233));
    m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
    m_ListCtrl.InsertColumn(0,_T("学号"),LVCFMT_IMAGE|LVCFMT_LEFT);
	m_ListCtrl.InsertColumn(1,_T("姓名"));
	m_ListCtrl.InsertColumn(2,_T("班级"));
	m_ListCtrl.InsertColumn(3,_T("英语"));
	int j;
    for(j=0;j<4;j++)
	{
	  m_ListCtrl.SetColumnWidth(j ,60);
	} 
//	m_1=m_pSet->m_column5;
//显示所有记录
	this->Show();
//		Invalidate();
//	UpdateData(FALSE);
}

/////////////////////////////////////////////////////////////////////////////
// CMy777View printing

BOOL CMy777View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMy777View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMy777View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMy777View diagnostics

#ifdef _DEBUG
void CMy777View::AssertValid() const
{
	CDaoRecordView::AssertValid();
}

void CMy777View::Dump(CDumpContext& dc) const
{
	CDaoRecordView::Dump(dc);
}

CMy777Doc* CMy777View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMy777Doc)));
	return (CMy777Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMy777View database support
CDaoRecordset* CMy777View::OnGetRecordset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CMy777View message handlers

int CMy777View::Show()
{

	int i=0;
	m_pSet->MoveFirst();
//	m_ListCtrl.InsertItem(0,"");
   while(!m_pSet->IsEOF())
	{ 
	m_ListCtrl.InsertItem(0,"");
	m_ListCtrl.SetItemText(0,0,m_pSet->m_column1);
  	m_ListCtrl.SetItemText(0,1,m_pSet->m_column2);
	m_ListCtrl.SetItemText(0,2,m_pSet->m_column4);
	m_ListCtrl.SetItemText(0,3,m_pSet->m_column5);
	m_pSet->MoveNext();
   }
        m_pSet->MoveFirst();
	return i;
}

HBRUSH CMy777View::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	
		return m_Brush;
	// TODO: Change any attributes of the DC here
	
	// TODO: Return a different brush if the default is not desired

}

void CMy777View::OnEdit() 
{
	// TODO: Add your control notification handler code here
	  UpdateData(true);
	  CEditDialog dlg;
	  dlg.m_B=m_pSet->m_column1;
	  dlg.m_A=m_pSet->m_column5;
      dlg.DoModal();
	  y=dlg.m_A;
	  x=dlg.m_B;
	Invalidate();
//	UpdateData(FALSE);
}

void CMy777View::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
UpdateData(true);
CEditDialog dlg;
pos=m_ListCtrl.GetSelectionMark();
dlg.m_A=m_ListCtrl.GetItemText(pos,0);
dlg.m_B=m_ListCtrl.GetItemText(pos,3);
dlg.DoModal();
//UpdateData(FALSE);
y=dlg.m_A;
x=dlg.m_B;
Invalidate();
	//UpdateData(true);
	//pos=m_ListCtrl.GetSelectionMark();
	//m_1=m_ListCtrl.GetItemText(pos,0);
	//UpdateData(false);
	*pResult = 0;
}

void CMy777View::OnDraw(CDC* pDC) 
{
	// TODO: Add your specialized code here and/or call the base class
//	C777Doc* pDoc = GetDocument();
//	ASSERT_VALID(pDoc);
pDC->SetMapMode(MM_LOMETRIC);
pDC->SetBkMode(TRANSPARENT);
CFont Myfont;
Myfont.CreateFont(210,
118,0,0,300,FALSE,FALSE,0,
GB2312_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
VARIABLE_PITCH|FF_MODERN,
"方正综艺简体");
pDC->BeginPath();
CFont * pOldFont=pDC->SelectObject(&Myfont);
pDC->TextOut(0,0,y);
pDC->TextOut(0,-200,x);
pDC->EndPath();
pDC->StrokePath();	
pDC->SelectObject(pOldFont); 
}

⌨️ 快捷键说明

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