📄 xindowform.cpp
字号:
// XindowForm1.cpp : implementation file
//
#include "stdafx.h"
#include "Xindow.h"
#include "XindowForm.h"
#include "XindowView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CXindowForm
IMPLEMENT_DYNCREATE(CXindowForm, CFormView)
CXindowForm::CXindowForm()
: CFormView(CXindowForm::IDD)
{
//{{AFX_DATA_INIT(CXindowForm)
//}}AFX_DATA_INIT
}
CXindowForm::~CXindowForm()
{
}
void CXindowForm::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CXindowForm)
DDX_Control(pDX, IDC_ADD2, m_add);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CXindowForm, CFormView)
//{{AFX_MSG_MAP(CXindowForm)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CXindowForm diagnostics
#ifdef _DEBUG
void CXindowForm::AssertValid() const
{
CFormView::AssertValid();
}
void CXindowForm::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CXindowForm message handlers
/*
* 使背景变成白色
*/
HBRUSH CXindowForm::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
UNREFERENCED_PARAMETER(pWnd);
UNREFERENCED_PARAMETER(nCtlColor);
if (m_hBrush != NULL)
::DeleteObject(m_hBrush);
m_hBrush = ::CreateSolidBrush(RGB(255,255,255));
pDC->SetBkColor(RGB(255,255,255));
pDC->SetTextColor(RGB(0,0,0));
return m_hBrush;
}
void CXindowForm::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
/* 相当于CListCtrl::SetItemData(), 用于区别是哪个CXLabel */
m_add.SetCommand(1);
}
BOOL CXindowForm::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
LPNMHDR pnmh = (LPNMHDR) lParam;
if(pnmh->code==NM_LINKCLICK)
{
CXLabel* pLabel = (CXLabel *)GetDlgItem(pnmh->idFrom);
CString str;
/* GetCommand() */
str.Format("%d",pLabel->GetCommand());
AfxMessageBox(str);
if(m_pParent->GetSafeHwnd())
{
CListCtrl& listCtrl = ((CXindowView*)m_pParent)->m_pList->GetListCtrl();
int nCount = listCtrl.GetItemCount();
int nItem = listCtrl.InsertItem(nCount, "2003-8-15");
listCtrl.SetItemText(nItem, 1, "192.168.3.1");
listCtrl.SetItemText(nItem, 2, "www.vccode.com");
listCtrl.SetItemText(nItem, 3, "编程");
}
}
return CFormView::OnNotify(wParam, lParam, pResult);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -