📄 interfaceview.cpp
字号:
// InterfaceView.cpp : Implementierung der Klasse CInterfaceView
//
#include "stdafx.h"
#include "Interface.h"
#include "InterfaceDoc.h"
#include "InterfaceView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInterfaceView
IMPLEMENT_DYNCREATE(CInterfaceView, CFormView)
BEGIN_MESSAGE_MAP(CInterfaceView, CFormView)
//{{AFX_MSG_MAP(CInterfaceView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInterfaceView Konstruktion/Destruktion
CInterfaceView::CInterfaceView()
: CFormView(CInterfaceView::IDD)
{
//{{AFX_DATA_INIT(CInterfaceView)
// HINWEIS: Der Klassenassistent f黦t hier Member-Initialisierung ein
//}}AFX_DATA_INIT
m_bInitiated=false;
}
CInterfaceView::~CInterfaceView()
{
}
void CInterfaceView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInterfaceView)
DDX_Control(pDX, IDC_LIST1, m_Table);
//}}AFX_DATA_MAP
}
BOOL CInterfaceView::PreCreateWindow(CREATESTRUCT& cs)
{
return CFormView::PreCreateWindow(cs);
}
void CInterfaceView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
if (!m_bInitiated)
{
// I know, I know, this could be easear
CString t1 = "Item\nSubitem1\nSubitem2\nSubitem3\nSubitem4\n",
t2;
int idx = t1.Find('\n'), i = 0;
while (idx != -1 && i<5)
{
t2 = t1.Left(idx);
t1 = t1.Mid(idx+1);
m_Table.InsertColumn(i, t2, LVCFMT_LEFT, 75);
i++;
idx = t1.Find('\n');
}
m_bInitiated = true;
}
}
/////////////////////////////////////////////////////////////////////////////
// CInterfaceView Diagnose
#ifdef _DEBUG
void CInterfaceView::AssertValid() const
{
CFormView::AssertValid();
}
void CInterfaceView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CInterfaceDoc* CInterfaceView::GetDocument() // Die endg黮tige (nicht zur Fehlersuche kompilierte) Version ist Inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CInterfaceDoc)));
return (CInterfaceDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CInterfaceView Message-Handler
void CInterfaceView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
m_Table.DeleteAllItems();
int count = GetDocument()->m_Strings.GetUpperBound();
for (int i=0; i<=count; i++)
InsertRow(GetDocument()->m_Strings[i]);
}
int CInterfaceView::InsertRow(CString TabSeparated)
{
CString t1(TabSeparated), t2;
int idx = t1.Find('\t'), i = 1, row=LB_ERR;
if (idx !=-1)
{
t2 = t1.Left(idx);
t1 = t1.Mid(idx+1);
row = m_Table.InsertItem(m_Table.GetItemCount()+1, t2);
idx = t1.Find('\t');
}
while (idx != -1 && i < 5 && row != LB_ERR)
{
t2 = t1.Left(idx);
t1 = t1.Mid(idx+1);
m_Table.SetItemText(row, i, t2);
CString deb = m_Table.GetItemText(row, i);
i++;
idx = t1.Find('\t');
}
return row;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -