📄 dropdialog.cpp
字号:
// DropDialog.cpp: Implementierungsdatei
//
#include "stdafx.h"
#include "Interface.h"
#include "DropDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Dialogfeld CDropDialog
IMPLEMENT_DYNAMIC(CDropDialog, CDialog) // for runtime-checking
CDropDialog::CDropDialog(CWnd* pParent /*=NULL*/)
: CDialog(CDropDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CDropDialog)
// HINWEIS: Der Klassen-Assistent f黦t hier Elementinitialisierung ein
//}}AFX_DATA_INIT
CString format = AfxGetApp()->GetProfileString("DragDrop", "Clipformat", "Common");
if (format == "Private")
m_DragDropFormat = ::RegisterClipboardFormat("InterfaceClipboardFormat");
else
{
if (format != "Common")
AfxMessageBox("Please specify a valid clipformat!", MB_ICONSTOP);
m_DragDropFormat = CF_TEXT;
}
}
void CDropDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDropDialog)
DDX_Control(pDX, IDC_LIST1, m_DropTable);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDropDialog, CDialog)
//{{AFX_MSG_MAP(CDropDialog)
ON_BN_CLICKED(IDC_RESET, OnReset)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Behandlungsroutinen f黵 Nachrichten CDropDialog
BOOL CDropDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_DT.Register(this);
CString t;
for (int i=0; i<5; i++)
{
t.Format ("Column %i", i);
m_DropTable.InsertColumn(i, t, LVCFMT_LEFT, 75);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zur點kgeben
}
void CDropDialog::OnReset()
{
m_DropTable.DeleteAllItems();
}
void CDropDialog::InsertData(int row, int column, CString data)
{
if (column == 0)
m_DropTable.InsertItem(row, data);
else
m_DropTable.SetItemText(row, column, data);
}
void CDropDialog::ProcessData(CString Data)
{
CString t1(Data), t2;
int idx = t1.Find('\n'), i = 0;
while (idx != -1 && i<5)
{
t2 = t1.Left(idx);
t1 = t1.Mid(idx+1);
InsertRow(t2);
i++;
idx = t1.Find('\n');
}
}
int CDropDialog::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_DropTable.InsertItem(m_DropTable.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_DropTable.SetItemText(row, i, t2);
i++;
idx = t1.Find('\t');
}
return row;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -