本文整理汇总了C++中CListBox::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CListBox::GetCount方法的具体用法?C++ CListBox::GetCount怎么用?C++ CListBox::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CListBox
的用法示例。
在下文中一共展示了CListBox::GetCount方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MessageDelivered
void CNewsHubDlg::MessageDelivered(NewsHub::ClientQueueThreadLoop* queue, const NewsHub::Socket & socket, const unsigned int messageId, const std::string & message)
{
CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
for (int i = 0; i < pSentMessages->GetCount(); ++i)
{
MessageInfo* messageInfo = (MessageInfo*)pSentMessages->GetItemDataPtr(i);
if ((messageInfo->queue == queue) && (messageInfo->messageId == messageId))
{
CString str;
pSentMessages->GetText(i, str);
pSentMessages->DeleteString(i);
pSentMessages->InsertString(i, str + _T(": Delivered"));
pSentMessages->SetItemDataPtr(i, messageInfo);
pSentMessages->SetCurSel(i);
break;
}
}
}
示例2: AdjustHorzScroll
void CSideWnd::AdjustHorzScroll(CListBox& wndListBox)
{
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(&m_Font);
int cxExtentMax = 0;
for (int i = 0; i < wndListBox.GetCount(); i ++)
{
CString strItem;
wndListBox.GetText(i, strItem);
cxExtentMax = max(cxExtentMax, dc.GetTextExtent(strItem).cx);
}
wndListBox.SetHorizontalExtent(cxExtentMax);
dc.SelectObject(pOldFont);
}
示例3: AdjustHorzScroll
void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
{
CClientDC dc(this);
CFont* pOldFont = dc.SelectObject(&afxGlobalData.fontRegular);
int cxExtentMax = 0;
for (int i = 0; i < wndListBox.GetCount(); i ++)
{
CString strItem;
wndListBox.GetText(i, strItem);
cxExtentMax = max(cxExtentMax, (int)dc.GetTextExtent(strItem).cx);
}
wndListBox.SetHorizontalExtent(cxExtentMax);
dc.SelectObject(pOldFont);
}
示例4: RecalculateRotation
void CDizzyDialog::RecalculateRotation()
{
CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
int num = pListBox->GetCount();
if (num == 0) {
CAxisRotation rotResult;
char* pszResult = rotResult.ToString(m_iPrecision);
m_strResult = pszResult;
free(pszResult);
}
else if (num == 1) {
CString strOnly;
pListBox->GetText(0,strOnly);
CAxisRotation rotResult;
rotResult.ParseString(strOnly);
rotResult = rotResult.Normalise();
char* pszResult = rotResult.ToString(m_iPrecision);
m_strResult = pszResult;
free(pszResult);
}
else {
if (num > 1) {
CString strFirst;
pListBox->GetText(0, strFirst);
CAxisRotation rotFirst;
rotFirst.ParseString(strFirst);
CQuaternion quatResult(rotFirst);
for (int i=1; i<num; i++) {
CString strData;
pListBox->GetText(i, strData);
CAxisRotation rotData;
rotData.ParseString(strData);
CQuaternion quatData(rotData);
quatResult = quatData * quatResult;
}
CAxisRotation rotResult(quatResult);
char* pszResult = rotResult.ToString(m_iPrecision);
m_strResult = pszResult;
free(pszResult);
}
}
}
示例5: ShowInPlaceListBox
CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel)
{
CRect rect;
if (!PrepareInPlaceControl(nItem, nCol, rect)) {
return nullptr;
}
DWORD dwStyle = WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL/*|WS_HSCROLL*/ | LBS_NOTIFY;
CListBox* pListBox = DEBUG_NEW CInPlaceListBox(nItem, nCol, lstItems, nSel);
pListBox->Create(dwStyle, rect, this, IDC_LIST1);
CRect ir;
GetItemRect(m_nItemClicked, &ir, LVIR_BOUNDS);
pListBox->SetItemHeight(-1, ir.Height());
CDC* pDC = pListBox->GetDC();
CFont* pWndFont = GetFont();
pDC->SelectObject(pWndFont);
int width = GetColumnWidth(nCol);
POSITION pos = lstItems.GetHeadPosition();
while (pos) {
int w = pDC->GetTextExtent(lstItems.GetNext(pos)).cx + 16;
if (width < w) {
width = w;
}
}
ReleaseDC(pDC);
CRect r;
pListBox->GetWindowRect(r);
ScreenToClient(r);
r.top = ir.bottom;
r.bottom = r.top + pListBox->GetItemHeight(0) * (pListBox->GetCount() + 1);
r.right = r.left + width;
pListBox->MoveWindow(r);
m_fInPlaceDirty = false;
return pListBox;
}
示例6: OnShowWindow
void CLoadFailedTextureDialog::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LOADFAILED_LIST);
if (NULL != pListBox)
{
int i = 0;
for (i = 0; i < pListBox->GetCount(); i++)
{
pListBox->DeleteString(0);
}
for (i = 0; i < (int)m_dwLoadFailedTextureTableCount; i++)
{
pListBox->InsertString(i, m_pLoadFailedTextureTable[i].szTextureName);
}
}
}
示例7: OnEnChangeBrowseSave
void CFirstFollowDlg::OnEnChangeBrowseSave()
{
// TODO: 如果该控件是 RICHEDIT 控件,它将不
// 发送此通知,除非重写 CDialogEx::OnInitDialog()
// 函数并调用 CRichEditCtrl().SetEventMask(),
// 同时将 ENM_CHANGE 标志“或”运算到掩码中。
// TODO: 在此添加控件通知处理程序代码
CListBox *list = (CListBox*)GetDlgItem(IDC_LIST_PROD);
if (list->GetCount() == 0)
{
MessageBox(_T("there is nothing to save!"));
return;
}
CString path;
GetDlgItemText(IDC_BROWSE_SAVE,path);
if(path.GetLength() == 0) return;
SetDlgItemText(IDC_BROWSE_SAVE,_T(""));
StreamHelper::putStreamToFileStream(this->productionList,path.GetBuffer(0));
}
示例8: OnBnClickedButtonClear
void CFirstFollowDlg::OnBnClickedButtonClear()
{
// TODO: 在此添加控件通知处理程序代码
CListBox *listbox = (CListBox *)GetDlgItem(IDC_LIST_PROD);
if (listbox->GetCount() == 0)
return;
CComboBox *combobox = (CComboBox *)GetDlgItem(IDC_COMBO_NONTERM);
// Delete every other item from the combo box.
listbox->ResetContent();
combobox->ResetContent();
SetDlgItemText(IDC_EDIT_FIRST,_T(""));
SetDlgItemText(IDC_EDIT_FOLLOW,_T(""));
this->productionList.swap(vector<string>());
this->orignProductions.swap(vector<string>());
this->allFirstGather.swap(vector<string>());
this->allFollowGather.swap(vector<string>());
if(this->grammar != NULL)
{
delete this->grammar;
this->grammar = NULL;
}
}
示例9: OnAddButton
void CDizzyDialog::OnAddButton()
{
UpdateData(true);
CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
CAxisRotation inputRotation;
bool bValidString = inputRotation.ParseString(m_strInput);
if (bValidString) {
int iOffset = pListBox->GetCurSel();
if (iOffset != LB_ERR) {
pListBox->InsertString(iOffset+1,m_strInput);
pListBox->SetCurSel(iOffset+1);
}
else {
pListBox->AddString(m_strInput);
pListBox->SetCurSel(pListBox->GetCount()-1);
}
RecalculateRotation();
m_strInput = "";
UpdateData(false);
}
else {
::AfxMessageBox("Input must be a valid axis-angle rotation!");
}
}
示例10: ClearListBox
void ClearListBox(CListBox& box)
{
while (box.GetCount() > 0)
box.DeleteString(0);
}
示例11: GetLibCount
int CProjectDoc::GetLibCount()
{
CListBox* pLB = (CListBox*)GetProjectView()->GetDlgItem(IDP_LIBLIST);
return pLB->GetCount();
}
示例12: GetFileCount
int CProjectDoc::GetFileCount()
{
CListBox* pLB = (CListBox*)GetProjectView()->GetDlgItem(IDP_FILELIST);
return pLB->GetCount();
}
示例13: OnAddTotem
void CSpellBaseParmDlg::OnAddTotem()
{
CString sTotem;
CString sLevel;
CString sRequires;
CComboBox *pBox;
CListBox *pList;
pBox = (CComboBox *)GetDlgItem(IDC_TOTEMS);
pBox->GetWindowText(sTotem);
pBox = (CComboBox *)GetDlgItem(IDC_LEVELS);
pBox->GetWindowText(sLevel);
pList = (CListBox *)GetDlgItem(IDC_REQUIRESTOTEM);
if (sLevel == "Any Level")
{
sRequires = sTotem;
sRequires += " of any level";
}
else
{
sRequires = sTotem;
sRequires += " level ";
sRequires += sLevel;
}
// Check before we add this totem
for (int i = 0; i < pList->GetCount(); i ++)
{
CString sListString;
pList->GetText(i, sListString);
CString sString = sListString;
BOOL bOkayToAdd = TRUE;
if (sRequires == sString)
{
AfxMessageBox("Totem level requirement already exists !!!", MB_ICONEXCLAMATION);
return;
}
CString sCheckTotem = strtok((char *)(LPCSTR)sString, " ");
if (sCheckTotem == sTotem)
{
AfxMessageBox("Totem level requirement already exists !!!", MB_ICONEXCLAMATION);
return;
}
}
pList->AddString(sRequires);
TOTEM_REQUIREMENT tr;
tr.m_sRequirement = sRequires;
m_pSpell->GetTotemRequirements()->AddTail(tr);
}