当前位置: 首页>>代码示例>>C++>>正文


C++ GetCount函数代码示例

本文整理汇总了C++中GetCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCount函数的具体用法?C++ GetCount怎么用?C++ GetCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void CheckPointListBox::DeleteAllItems() {
  while (GetCount() > 0) {
    DeleteString(0);
  }
}
开发者ID:Echo-M,项目名称:producingManagementAK47,代码行数:5,代码来源:check_point_list_box.cpp

示例2: IsEmpty

bool CCQuestNPCQueue::IsEmpty()
{
	if ((m_Queue.empty()) || (m_nCursor >= GetCount())) return true;
	return false;
}
开发者ID:Kallontz,项目名称:gunz-the-tps-mmorpg,代码行数:5,代码来源:CCQuestLevel.cpp

示例3: Enable

// Enable all subcontrols
bool wxRadioBox::Enable(bool enable)
{
    for(int i=0; i<GetCount(); i++)
        Enable(i, enable);
    return true;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:7,代码来源:radiobox.cpp

示例4: GetCount

int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const
{
    const int itemStart = item;

    int count = GetCount(),
        numCols = GetColumnCount(),
        numRows = GetRowCount();

    bool horz = (style & wxRA_SPECIFY_COLS) != 0;

    do
    {
        switch ( dir )
        {
            case wxUP:
                if ( horz )
                {
                    item -= numCols;
                }
                else // vertical layout
                {
                    if ( !item-- )
                        item = count - 1;
                }
                break;

            case wxLEFT:
                if ( horz )
                {
                    if ( !item-- )
                        item = count - 1;
                }
                else // vertical layout
                {
                    item -= numRows;
                }
                break;

            case wxDOWN:
                if ( horz )
                {
                    item += numCols;
                }
                else // vertical layout
                {
                    if ( ++item == count )
                        item = 0;
                }
                break;

            case wxRIGHT:
                if ( horz )
                {
                    if ( ++item == count )
                        item = 0;
                }
                else // vertical layout
                {
                    item += numRows;
                }
                break;

            default:
                wxFAIL_MSG( wxT("unexpected wxDirection value") );
                return wxNOT_FOUND;
        }

        // ensure that the item is in range [0..count)
        if ( item < 0 )
        {
            // first map the item to the one in the same column but in the last
            // row
            item += count;

            // now there are 2 cases: either it is the first item of the last
            // row in which case we need to wrap again and get to the last item
            // or we can just go to the previous item
            if ( item % (horz ? numCols : numRows) )
                item--;
            else
                item = count - 1;
        }
        else if ( item >= count )
        {
            // same logic as above
            item -= count;

            // ... except that we need to check if this is not the last item,
            // not the first one
            if ( (item + 1) % (horz ? numCols : numRows) )
                item++;
            else
                item = 0;
        }

        wxASSERT_MSG( item < count && item >= 0,
                      wxT("logic error in wxRadioBox::GetNextItem()") );
    }
    // we shouldn't select the non-active items, continue looking for a
    // visible and shown one unless we came back to the item we started from in
//.........这里部分代码省略.........
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:101,代码来源:radiocmn.cpp

示例5: AdjustDisplayRectangle

int COXListPopup::Pick(CRect rect, CRect rectParent)
{
	AdjustDisplayRectangle(rect, rectParent);

	MoveWindow(rect);
	ShowWindow(SW_SHOWNA);
	SetCapture();

	// init message loop
	bool bBreak = false;
	int iReturnItemIdx = -1;
	while (!bBreak)
	{
		MSG msg;
		VERIFY(::GetMessage(&msg, NULL, 0, 0));
		if (msg.message == WM_LBUTTONUP)
		{
			// Get the item under the mouse cursor
			int xPos = GET_X_LPARAM(msg.lParam); 
			int yPos = GET_Y_LPARAM(msg.lParam);

			BOOL bOutside;
			UINT nIndex = ItemFromPoint(CPoint(xPos, yPos), bOutside);
			if (!bOutside)
				iReturnItemIdx = (int) nIndex;
			bBreak = true;
		}
		else if (msg.message == WM_KEYDOWN)
		{
			// Handle ESCAPE, UP, DOWN and ENTER
			if (msg.wParam == VK_ESCAPE)
				bBreak = true;
			else if (msg.wParam == VK_UP)
			{
				int iSel = GetCurSel();
				if (iSel == -1 || iSel == 0)
					SetCurSel(0);
				else
					SetCurSel(iSel - 1);
			}
			else if (msg.wParam == VK_DOWN)
			{
				// Move the selection 1 item down
				int iSel = GetCurSel();
				if (iSel == -1)
					SetCurSel(0);
				else if (iSel == GetCount() - 1)
				{
					// Do nothing
				}
				else
					SetCurSel(iSel + 1);
			}
			else if (msg.wParam == VK_RETURN)
			{
				iReturnItemIdx = GetCurSel();
				bBreak = true;
			}
		}
		else if (msg.message == WM_LBUTTONDOWN)
		{
			// Do nothing				
		}
		else if (msg.message == WM_MOUSEMOVE)
		{
			// Select the item under the mouse cursor
			int xPos = GET_X_LPARAM(msg.lParam); 
			int yPos = GET_Y_LPARAM(msg.lParam);

			BOOL bOutside;
			UINT nIndex = ItemFromPoint(CPoint(xPos, yPos), bOutside);
			if (!bOutside)
				SetCurSel((int) nIndex);
		}
		else
		{
			DispatchMessage(&msg);
		}
	}

	ReleaseCapture();
	ShowWindow(SW_HIDE);

	return iReturnItemIdx;
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:85,代码来源:OXListEdit.cpp

示例6: SetName

{
	SetName("Hask");
}

void
	MoleculesHaskell::
	Init(const bool) throw (...)
{
	struct ParallelScript::NamedFunctions_s
		funcs[] =
		{
			{"[email protected]", (void **)&GenerateMolecules},
			{0, 0}
		};
	ScriptInit(L"MoleculesHaskell.dll", funcs);
	GenerateMolecules((float *)GetAtoms().GetData(), (int)GetCount(), GetHeight(), GetWidth());
	CUmodule
		module = 0;
	TryCUDA(cuModuleLoad(&module, "MoleculesHaskell.ptx"));
	m_kernel = 0;
	TryCUDA(cuModuleGetFunction(&m_kernel, module, "DoAtoms"));
}

void
	MoleculesHaskell::
	Execute() throw (...)
{
	//printf("0");
	size_t
		height = GetHeight(),
		width = GetWidth(),
开发者ID:Y-Less,项目名称:PEGGY,代码行数:31,代码来源:MoleculesHaskell.cpp

示例7: GetCount

// returns true if key was consumed
bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar keychar )
{
    const int itemCount = GetCount();

    // keys do nothing in the empty control and returning immediately avoids
    // using invalid indices below
    if ( !itemCount )
        return false;

    int value = m_value;
    int comboStyle = m_combo->GetWindowStyle();

    if ( keychar > 0 )
    {
        // we have character equivalent of the keycode; filter out these that
        // are not printable characters
        if ( !wxIsprint(keychar) )
            keychar = 0;
    }

    if ( keycode == WXK_DOWN || keycode == WXK_NUMPAD_DOWN || keycode == WXK_RIGHT )
    {
        value++;
        StopPartialCompletion();
    }
    else if ( keycode == WXK_UP || keycode == WXK_NUMPAD_UP || keycode == WXK_LEFT )
    {
        value--;
        StopPartialCompletion();
    }
    else if ( keycode == WXK_PAGEDOWN || keycode == WXK_NUMPAD_PAGEDOWN )
    {
        value+=10;
        StopPartialCompletion();
    }
    else if ( keycode == WXK_PAGEUP || keycode == WXK_NUMPAD_PAGEUP )
    {
        value-=10;
        StopPartialCompletion();
    }
    else if ( keycode == WXK_HOME || keycode == WXK_NUMPAD_HOME )
    {
        value=0;
        StopPartialCompletion();
    }
    else if ( keycode == WXK_END || keycode == WXK_NUMPAD_END )
    {
        value=itemCount-1;
        StopPartialCompletion();
    }
    else if ( keychar && (comboStyle & wxCB_READONLY) )
    {
        // Try partial completion

        // find the new partial completion string
#if wxUSE_TIMER
        if (m_partialCompletionTimer.IsRunning())
            m_partialCompletionString+=wxString(keychar);
        else
#endif // wxUSE_TIMER
            m_partialCompletionString=wxString(keychar);

        // now search through the values to see if this is found
        int found = -1;
        unsigned int length=m_partialCompletionString.length();
        int i;
        for (i=0; i<itemCount; i++)
        {
            wxString item=GetString(i);
            if (( item.length() >= length) && (!  m_partialCompletionString.CmpNoCase(item.Left(length))))
            {
                found=i;
                break;
            }
        }

        if (found<0)
        {
            StopPartialCompletion();
            ::wxBell();
            return true; // to stop the first value being set
        }
        else
        {
            value=i;
#if wxUSE_TIMER
            m_partialCompletionTimer.Start(wxODCB_PARTIAL_COMPLETION_TIME, true);
#endif // wxUSE_TIMER
        }
    }
    else
        return false;

    if ( saturate )
    {
        if ( value >= itemCount )
            value = itemCount - 1;
        else if ( value < 0 )
            value = 0;
//.........这里部分代码省略.........
开发者ID:drvo,项目名称:wxWidgets,代码行数:101,代码来源:odcombo.cpp

示例8: GetDataBrowserTableViewColumnProperty

int wxListBox::DoListHitTest(const wxPoint& inpoint) const
{
    OSStatus err;

    // There are few reasons why this is complicated:
    // 1) There is no native HitTest function for Mac
    // 2) GetDataBrowserItemPartBounds only works on visible items
    // 3) We can't do it through GetDataBrowserTableView[Item]RowHeight
    //    because what it returns is basically inaccurate in the context
    //    of the coordinates we want here, but we use this as a guess
    //    for where the first visible item lies

    wxPoint point = inpoint;

    // get column property ID (req. for call to itempartbounds)
    DataBrowserTableViewColumnID colId = 0;
    err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId);
    wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewColumnProperty"));

    // OK, first we need to find the first visible item we have -
    // this will be the "low" for our binary search. There is no real
    // easy way around this, as we will need to do a SLOW linear search
    // until we find a visible item, but we can do a cheap calculation
    // via the row height to speed things up a bit
    UInt32 scrollx, scrolly;
    err = GetDataBrowserScrollPosition(m_peer->GetControlRef(), &scrollx, &scrolly);
    wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserScrollPosition"));

    UInt16 height;
    err = GetDataBrowserTableViewRowHeight(m_peer->GetControlRef(), &height);
    wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewRowHeight"));

    // these indices are 0-based, as usual, so we need to add 1 to them when
    // passing them to data browser functions which use 1-based indices
    int low = scrolly / height,
        high = GetCount() - 1;

    // search for the first visible item (note that the scroll guess above
    // is the low bounds of where the item might lie so we only use that as a
    // starting point - we should reach it within 1 or 2 iterations of the loop)
    while ( low <= high )
    {
        Rect bounds;
        err = GetDataBrowserItemPartBounds(
            m_peer->GetControlRef(), low + 1, colId,
            kDataBrowserPropertyEnclosingPart,
            &bounds); // note +1 to translate to Mac ID
        if ( err == noErr )
            break;

        // errDataBrowserItemNotFound is expected as it simply means that the
        // item is not currently visible -- but other errors are not
        wxCHECK_MSG( err == errDataBrowserItemNotFound, wxNOT_FOUND,
                     wxT("Unexpected error from GetDataBrowserItemPartBounds") );

        low++;
    }

    // NOW do a binary search for where the item lies, searching low again if
    // we hit an item that isn't visible
    while ( low <= high )
    {
        int mid = (low + high) / 2;

        Rect bounds;
        err = GetDataBrowserItemPartBounds(
            m_peer->GetControlRef(), mid + 1, colId,
            kDataBrowserPropertyEnclosingPart,
            &bounds); //note +1 to trans to mac id
        wxCHECK_MSG( err == noErr || err == errDataBrowserItemNotFound,
                     wxNOT_FOUND,
                     wxT("Unexpected error from GetDataBrowserItemPartBounds") );

        if ( err == errDataBrowserItemNotFound )
        {
            // item not visible, attempt to find a visible one
            // search lower
            high = mid - 1;
        }
        else // visible item, do actual hitttest
        {
            // if point is within the bounds, return this item (since we assume
            // all x coords of items are equal we only test the x coord in
            // equality)
            if ((point.x >= bounds.left && point.x <= bounds.right) &&
                (point.y >= bounds.top && point.y <= bounds.bottom) )
            {
                // found!
                return mid;
            }

            if ( point.y < bounds.top )
                // index(bounds) greater then key(point)
                high = mid - 1;
            else
                // index(bounds) less then key(point)
                low = mid + 1;
        }
    }

//.........这里部分代码省略.........
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:101,代码来源:listbox.cpp

示例9: Reset

void MyListModel::AddMany()
{
    Reset( GetCount()+1000 );
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:4,代码来源:mymodels.cpp

示例10: ADDTOCALLSTACK

CItem* CContainer::ContentFindRandom() const
{
	ADDTOCALLSTACK("CContainer::ContentFindRandom");
	// returns Pointer of random item, NULL if player carrying none
	return( dynamic_cast <CItem*> ( GetAt( Calc_GetRandVal( GetCount()))));
}
开发者ID:greeduomacro,项目名称:Source,代码行数:6,代码来源:CContain.cpp

示例11: GetText

void CListBoxEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	m_pwndSBV->MoveWindow(m_rcSBV);

	if ((int)lpDrawItemStruct->itemID < 0)
		return; 

	CString text;
	GetText(lpDrawItemStruct->itemID, text);
	CRect rect = lpDrawItemStruct->rcItem;

	int cntItem = GetCount();
	int numShow = m_rcSBV.Height() / m_nItemHeight;
	// 스크롤바가 생성되면 List Box의 드로우 영역을 줄인다.
	if (cntItem > numShow)
		rect.right -= 20;

	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
	Graphics mainG (lpDrawItemStruct->hDC);

	Color clrText = m_clrTextNom;
	// 선택된 Item 영역 그리는 부분.
	if ((lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
	{
		DrawItem(&mainG,rect,m_clrItemHot);
		clrText = m_clrTextHot;
		DrawText(&mainG,rect,text,clrText);
	}

	// 기본 Item 영역 그리는 부분.
	if (!(lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
	{
		if (m_bModeOneColor == true)
		{
			DrawItem(&mainG,rect,m_clrItemNom1);
		}
		else
		{
			Color clr;
			lpDrawItemStruct->itemID%2 ? clr = m_clrItemNom1 : clr = m_clrItemNom2;
			DrawItem(&mainG,rect,clr);
		}
		DrawText(&mainG,rect,text,clrText);
	}

	// 선택 -> 미선택 Item 영역 그리는 부분.
	if (!(lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & ODA_SELECT))
	{
		if (m_bModeOneColor == true)
		{
			DrawItem(&mainG,rect,m_clrItemNom1);
		}
		else
		{
			Color clr;
			lpDrawItemStruct->itemID%2 ? clr = m_clrItemNom1 : clr = m_clrItemNom2;
			DrawItem(&mainG,rect,clr);
		}
		DrawText(&mainG,rect,text,clrText);
	}

}
开发者ID:luckygg,项目名称:ListBoxEx,代码行数:62,代码来源:ListBoxEx.cpp

示例12: CleanTemporary

void CDownloadGroups::Serialize(CArchive& ar)
{
	int nVersion = GROUPS_SER_VERSION;
	BYTE nState;

	if ( ar.IsStoring() )
	{
		CleanTemporary();

		ar << nVersion;

		ar.WriteCount( Downloads.GetCount() );

		for ( POSITION pos = Downloads.GetIterator() ; pos ; )
		{
			ar << Downloads.GetNext( pos )->m_nSerID;
		}

		ar.WriteCount( GetCount() );

		for ( POSITION pos = GetIterator() ; pos ; )
		{
			CDownloadGroup* pGroup = GetNext( pos );

			nState = ( pGroup == m_pSuper ) ? 1 : 0;
			ar << nState;

			pGroup->Serialize( ar, nVersion );
		}
	}
	else
	{
		ar >> nVersion;
		if ( nVersion <= 1 || nVersion > GROUPS_SER_VERSION ) AfxThrowUserException();

		DWORD_PTR nCount = ar.ReadCount();

		for ( ; nCount > 0 ; nCount-- )
		{
			DWORD nDownload;
			ar >> nDownload;
			if ( CDownload* pDownload = Downloads.FindBySID( nDownload ) )
				Downloads.Reorder( pDownload, NULL );
		}

		if ( ( nCount = ar.ReadCount() ) != 0 ) Clear();

		for ( ; nCount > 0 ; nCount-- )
		{
			CDownloadGroup* pGroup = Add();

			ar >> nState;
			if ( nState == 1 ) m_pSuper = pGroup;

			pGroup->Serialize( ar, nVersion );
		}

		if ( nVersion < 5 )
		{
			CDownloadGroup* pGroup = Add( _T("Image") );
			pGroup->SetSchema( CSchema::uriImage );
			pGroup->SetDefaultFilters();

			pGroup = Add( _T("Collection") );
			pGroup->SetSchema( CSchema::uriCollection );
			pGroup->SetDefaultFilters();
		}

		GetSuperGroup();

		for ( POSITION pos = Downloads.GetIterator() ; pos ; )
		{
			m_pSuper->Add( Downloads.GetNext( pos ) );
		}
	}
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:76,代码来源:DownloadGroups.cpp

示例13: CreateMenuWnd

	void CMenuElementUI::DoEvent(TEventUI& event)
	{
		if( event.Type == UIEVENT_MOUSEENTER )
		{
			CListContainerElementUI::DoEvent(event);
			if( m_pWindow ) return;
			bool hasSubMenu = false;
			for( int i = 0; i < GetCount(); ++i )
			{
				if( GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL )
				{
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetVisible(true);
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetInternVisible(true);

					hasSubMenu = true;
				}
			}
			if( hasSubMenu )
			{
				m_pOwner->SelectItem(GetIndex(), true);
				CreateMenuWnd();
			}
			else
			{
				ContextMenuParam param;
				param.hWnd = m_pManager->GetPaintWindow();
				param.wParam = 2;
				CMenuWnd::GetGlobalContextMenuObserver().RBroadcast(param);
				m_pOwner->SelectItem(GetIndex(), true);
			}
			return;
		}

		if( event.Type == UIEVENT_BUTTONUP )
		{
			if( IsEnabled() ){
				CListContainerElementUI::DoEvent(event);

				if( m_pWindow ) return;

				bool hasSubMenu = false;
				for( int i = 0; i < GetCount(); ++i ) {
					if( GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL ) {
						(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetVisible(true);
						(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetInternVisible(true);

						hasSubMenu = true;
					}
				}
				if( hasSubMenu )
				{
					CreateMenuWnd();
				}
				else
				{
					SetChecked(!GetChecked());

					MenuCmd* pMenuCmd = new MenuCmd();
					lstrcpy(pMenuCmd->szName, GetName().GetData());
					lstrcpy(pMenuCmd->szUserData, GetUserData().GetData());
					lstrcpy(pMenuCmd->szText, GetText().GetData());
					pMenuCmd->bChecked = GetChecked();

					ContextMenuParam param;
					param.hWnd = m_pManager->GetPaintWindow();
					param.wParam = 1;
					CMenuWnd::GetGlobalContextMenuObserver().RBroadcast(param);

					if (CMenuWnd::GetGlobalContextMenuObserver().GetManager() != NULL)
					{
						if (!PostMessage(CMenuWnd::GetGlobalContextMenuObserver().GetManager()->GetPaintWindow(), WM_MENUCLICK, (WPARAM)pMenuCmd, NULL))
						{
							delete pMenuCmd;
							pMenuCmd = NULL;
						}
					}
				}
			}

			return;
		}

		if ( event.Type == UIEVENT_KEYDOWN && event.chKey == VK_RIGHT )
		{
			if( m_pWindow ) return;
			bool hasSubMenu = false;
			for( int i = 0; i < GetCount(); ++i )
			{
				if( GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL )
				{
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetVisible(true);
					(static_cast<CMenuElementUI*>(GetItemAt(i)->GetInterface(_T("MenuElement"))))->SetInternVisible(true);

					hasSubMenu = true;
				}
			}
			if( hasSubMenu )
			{
				m_pOwner->SelectItem(GetIndex(), true);
				CreateMenuWnd();
//.........这里部分代码省略.........
开发者ID:Crawping,项目名称:IocpServerClient_Side,代码行数:101,代码来源:UIMenu.cpp

示例14: Append

void wxListBoxBase::AppendAndEnsureVisible(const wxString& s)
{
    Append(s);
    EnsureVisible(GetCount() - 1);
}
开发者ID:Duion,项目名称:Torsion,代码行数:5,代码来源:lboxcmn.cpp

示例15: DrawItem

void CSkinListBox::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
	return;
	//没有节点就不用继续执行了
	if( GetCount()==0 ) return;

	//变量定义
	CRect rcItem=lpDrawItemStruct->rcItem;
	CDC * pDCControl=CDC::FromHandle(lpDrawItemStruct->hDC);

 	//创建缓冲
 	CDC BufferDC;
 	CBitmap ImageBuffer;
 	BufferDC.CreateCompatibleDC(pDCControl);
 	ImageBuffer.CreateCompatibleBitmap(pDCControl,rcItem.Width(),rcItem.Height());
 
 	//设置环境
 	BufferDC.SelectObject(&ImageBuffer);
	BufferDC.SelectObject(GetCtrlFont());

	//获取字符
	CString strString;
	GetText(lpDrawItemStruct->itemID,strString);

	//计算位置
	CRect rcString;
	rcString.SetRect(4,0,rcItem.Width()-8,rcItem.Height());

	//颜色定义
	COLORREF crTextColor=((lpDrawItemStruct->itemState&ODS_SELECTED)!=0)?m_colSelectText:m_colNormalText;

	//绘画背景
	BufferDC.FillSolidRect(0,0,rcItem.Width(),rcItem.Height(),m_colBack);

	//节点选中
	if ( (lpDrawItemStruct->itemState&ODS_SELECTED) != 0 )
	{
		if ( m_pSelectImg!= NULL && !m_pSelectImg->IsNull() )
		{
			m_pSelectImg->Draw(&BufferDC,CRect(0,0,rcItem.Width(),rcItem.Height()));
		}
	}

	//节点高亮
	else if ( m_nHovenItem == lpDrawItemStruct->itemID )
	{
		if ( m_pBackImgH!= NULL && !m_pBackImgH->IsNull() )
		{
			m_pBackImgH->Draw(&BufferDC,CRect(0,0,rcItem.Width(),rcItem.Height()));
		}
	}

	//绘画字符
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SetTextColor(crTextColor);
	BufferDC.DrawText(strString,&rcString,DT_VCENTER|DT_SINGLELINE);

	//绘画界面
	pDCControl->BitBlt(rcItem.left,rcItem.top,rcItem.Width(),rcItem.Height(),&BufferDC,0,0,SRCCOPY);

 	//清理资源
 	BufferDC.DeleteDC();
 	ImageBuffer.DeleteObject();
}
开发者ID:HuugY,项目名称:MFC_Project,代码行数:64,代码来源:SkinListBox.cpp


注:本文中的GetCount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。