📄 inplacecombobox.cpp
字号:
// InPlaceComboBox.cpp : implementation file
//
#include "stdafx.h"
#include "Prog.h"
#include "InPlaceComboBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInPlaceComboBox
CInPlaceComboBox::CInPlaceComboBox(CWnd* pParent, CRect& rect, CGridCellComboBox* pCell, UINT nID,int nRow, int nColumn, UINT nFirstChar)
{
m_pCell=pCell;
m_nRow = nRow;
m_nColumn = nColumn;
DWORD dwEditStyle = CBS_SIMPLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST;
rect.bottom=rect.bottom+200;
if (!Create(dwEditStyle, rect, pParent, nID))
return;
SetFontLog(m_pCell->lfFont);
if(pCell->pAryData)
{
for(int i=0;i<pCell->pAryData->GetSize();i++)
{
AddString(pCell->pAryData->GetAt(i));
}
}
ShowWindow(1);
SetFocus();
}
CInPlaceComboBox::~CInPlaceComboBox()
{
}
BEGIN_MESSAGE_MAP(CInPlaceComboBox, CCJFlatComboBox)
//{{AFX_MSG_MAP(CInPlaceComboBox)
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInPlaceComboBox message handlers
void CInPlaceComboBox::PostNcDestroy()
{
CCJFlatComboBox::PostNcDestroy();
delete this;
}
void CInPlaceComboBox::OnKillFocus(CWnd* pNewWnd)
{
CCJFlatComboBox::OnKillFocus();
CString str=_T("");
int nCursel=GetCurSel();
if(nCursel>-1)
{
GetLBText(nCursel,str);
}
else
{
GetWindowText(str);
}
m_pCell->m_sText=str;
CGridCtrl* pOwner =(CGridCtrl*)GetOwner();
if (pOwner)
{
pOwner->RedrawCell(m_nRow,m_nColumn);
pOwner->SendMessageToParent(m_nRow, m_nColumn, GVN_ONENDCOMBOBOX);
}
PostMessage(WM_CLOSE, 0, 0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -