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


C++ DrawItem函数代码示例

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


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

示例1: ItemsRect

void ListPage::PartialDraw(short int iOldSel, short int iOldFirstInView)
{
	Rect r = ItemsRect();

	short int iDiff = m_firstItemInView - iOldFirstInView;
	if (iDiff !=0)
	{
		if (abs(iDiff)>1)
		{
			Draw();
			return;
		}

		int iH = (CountItemsInView()-1) * m_itemHeight;
		int ySrc = r.y;
		int yDst = r.y;

		if (iDiff == 1)
			ySrc += m_itemHeight;
		else
			yDst += m_itemHeight;

		TAP_Osd_Copy(m_osdRegionIndex, m_osdRegionIndex, r.x, ySrc, r.w, iH, r.x, yDst, false);
	}

	DrawItem(r, m_selectedItem);
		DrawItem(r, iOldSel);

	DrawFooterAndScrollBar();

	TAP_Osd_Copy(m_osdRegionIndex, GetTAPScreenRegion(), 0, 0, m_rcList.w, m_rcList.h, m_rcList.x, m_rcList.y, false);
}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:32,代码来源:ListPage.cpp

示例2: PaintTopRow

static void PaintTopRow(HDC hDC, HDC arrow, MENUITEM *items, MENUITEM *selected, int x, int y, HFONT font, int fontHeight)
{
    MENUITEM *orig = items;
    int orig_x = x;
    SIZE xx;
    xx.cx =40;
    while (items)
    {
        GetTextExtentPoint32W(hDC, items->text, wcslen(items->text), &xx);
        xx.cx += 16;
        DrawItem(hDC, items->text, selected == items, COLOR_BTNFACE, x, y, xx.cx, fontHeight);
        x += xx.cx;
        items = items->next;
    }
    DrawItem(hDC, L"<---->", FALSE, COLOR_WINDOW, x, y, xx.cx, fontHeight);    
    items = orig;
    x = orig_x;
    while (items)
    {
        SIZE xx;
        if (items->expanded)
            PaintColumn(hDC, arrow, items->popup, selected, x, y+fontHeight, font, fontHeight);
        GetTextExtentPoint32W(hDC, items->text, wcslen(items->text), &xx);
        xx.cx += 16;
        x += xx.cx;
        items = items->next;
    }
    
}
开发者ID:jossk,项目名称:OrangeC,代码行数:29,代码来源:drawmenu.c

示例3: SortArray

/* --------------------------------------------------------------------
* FUNCTION NAME: Draw
* DESCRIPTION  : Draws Combobox on console, will check whether to draw
*				  One label or the entire combobox using _isOpen.
* RETURN       : None.
* NOTES        : Polymorphic function - inherited from Widget.
* -------------------------------------------------------------------- */
void ComboBox::Draw(COORD CursorPosition, const HANDLE& console)
{
	if (!_comboNames.size())
		return;
	if (!_isSorted) {
		SortArray();
	}
	strVecItr itr = _comboNames.begin();
	if (!_isOpen) {
		_isOpen = true;
		CursorPosition = GetCoord();
		clearWidget(CursorPosition, console, GetLongestString() + 6, _comboNames.size()*HEIGHT_OF_CELL);
		while (itr->index != _selected)
			itr++;
		DrawItem(CursorPosition, console, itr, true);
	}
	else {
		while (itr != _comboNames.end())
		{
			_isOpen = false;
			if (itr->index == _selected)
				DrawItem(CursorPosition, console, itr, true);
			else
				DrawItem(CursorPosition, console, itr, false);
			CursorPosition.Y += 2;
			++itr;
		}
	}
}
开发者ID:GolanSabo,项目名称:Shenkar,代码行数:36,代码来源:ComboBox.cpp

示例4: VisibleLength

/*
bool TLView::ItemPosOnScreen(TLItem* item)
{
}
*/
long TLView::DrawTrack(wxDC& dc, long yoffset, TLTrack* track)
{
	gg_tl_dat start, end, delta_start;
	for ( TLItemList::Node *node = track->GetFirst(); node; node = node->GetNext() ) {
		TLItem *current = node->GetData();
		if ( !ItemVisible( current ) )
			continue;
		start = current->GetPosition() - m_PositionVisible;
		delta_start = 0;
		if ( start < 0 ) {
			delta_start = start;
			start = 0;
		}
		end = current->GetEndPosition() - m_PositionVisible;
		if ( end > VisibleLength() )
			end = VisibleLength();
		long left       = (long) ( start /  GetRealZoom() ) + VIEW_LEFT_BORDER;
		long delta_left = (long) ( delta_start / GetRealZoom() );
		long top        = yoffset - m_YscrollPosition;
		long width      = (long) ( ( end - start ) /  GetRealZoom() );
		long height     = track->GetHeight();
		DrawItem( dc, current, left, delta_left, top, width, height );
		for ( int i = 1; i < current->GetExtended(); i++ ) {
			DrawItem( dc, current, ( ( current->GetPosition() - m_PositionVisible ) / GetRealZoom() ) + VIEW_LEFT_BORDER + ( i * ( current->GetLen() / GetRealZoom() ) ), 0, top, ( current->GetLen() / GetRealZoom() ), height );
		}
	}
	return yoffset + track->GetHeight() + m_TrackDrawDist;
}
开发者ID:oracle2025,项目名称:ggseq,代码行数:33,代码来源:TLView.cpp

示例5: TEXT

void CInformationPanel::CRecordItem::Draw(HDC hdc,const RECT &Rect)
{
	if (m_fRecording) {
		TCHAR szText[256];
		int Length;

		unsigned int RecordSec=(unsigned int)(m_RecordTime/1000);
		Length=StdUtil::snprintf(szText,lengthof(szText),
			TEXT("● %d:%02d:%02d"),
			RecordSec/(60*60),(RecordSec/60)%60,RecordSec%60);
		if (m_WroteSize>=0) {
			unsigned int Size=
				(unsigned int)(m_WroteSize/(ULONGLONG)(1024*1024/100));
			Length+=StdUtil::snprintf(szText+Length,lengthof(szText)-Length,
									  TEXT(" / %d.%02d MB"),
									  Size/100,Size%100);
		}
		if (m_DiskFreeSpace>=0) {
			unsigned int FreeSpace=
				(unsigned int)(m_DiskFreeSpace/(ULONGLONG)(1024*1024*1024/100));
			StdUtil::snprintf(szText+Length,lengthof(szText)-Length,
							  TEXT(" / %d.%02d GB空き"),
							  FreeSpace/100,FreeSpace%100);
		}
		DrawItem(hdc,Rect,szText);
	} else {
		DrawItem(hdc,Rect,TEXT("■ <録画していません>"));
	}
}
开发者ID:DBCTRADO,项目名称:TVTest,代码行数:29,代码来源:InformationPanel.cpp

示例6: dc

void CMDITabsDialogBar::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	// prepare dc
    HGDIOBJ hOldFont = dc.SelectObject(g_PaintManager->m_FontBoldBC);

	DRAWITEMSTRUCT dis;
	dis.CtlType = ODT_TAB;
	dis.CtlID = GetDlgCtrlID();
	dis.hwndItem = GetSafeHwnd();
	dis.hDC = dc.GetSafeHdc();
	dis.itemAction = ODA_DRAWENTIRE;

	// draw the rest of the border
	CRect rClient, rPage;
	GetClientRect(&dis.rcItem);
	rPage = dis.rcItem;
	AdjustRect(FALSE, rPage);
	dis.rcItem.top = rPage.top - 2;

	DrawMainBorder(&dis);

	// paint the tabs first and then the borders
	int nTab = GetItemCount();
	int nSel = GetCurSel();

	if (!nTab) // no pages added
		return;

	while (nTab--)
	{
		if (nTab != nSel)
		{
			dis.itemID = nTab;
			dis.itemState = 0;

			VERIFY(GetItemRect(nTab, &dis.rcItem));
			DrawItem(&dis);
			//DrawItemBorder(&dis);
		}
	}

	// now selected tab
    if (nSel != -1)
    {
	    dis.itemID = nSel;
	    dis.itemState = ODS_SELECTED;

	    VERIFY(GetItemRect(nSel, &dis.rcItem));
	    DrawItem(&dis);
	    //DrawItemBorder(&dis);    
    }
    dc.SelectObject(hOldFont);
}
开发者ID:OmerMor,项目名称:SciCompanion,代码行数:55,代码来源:MDITabsDialogBar.cpp

示例7: DrawMenu

void DrawMenu()
{
  const struct menu * const menu = menu_current();
  FillMyBuffer(STARTING_ROW,PHONE_IDLE_BUFFER_ROWS,0x00);
  DrawCommonMenuIcons();
  DrawItem(&(menu->items[0]), BUTTON_ICON_A_F_ROW,LEFT_BUTTON_COLUMN);
  DrawItem(&(menu->items[1]), BUTTON_ICON_B_E_ROW,LEFT_BUTTON_COLUMN);
  DrawItem(&(menu->items[2]), BUTTON_ICON_C_D_ROW,LEFT_BUTTON_COLUMN);
  DrawItem(&(menu->items[3]), BUTTON_ICON_A_F_ROW,RIGHT_BUTTON_COLUMN);
  DrawItem(&(menu->items[4]), BUTTON_ICON_B_E_ROW,RIGHT_BUTTON_COLUMN);

}
开发者ID:Rodini,项目名称:MetaWatch-WDS11x-IAR,代码行数:12,代码来源:Menu.c

示例8: while

/* --------------------------------------------------------------------
* FUNCTION NAME: Draw_Color
* DESCRIPTION  : Draws Combobox on console, will be used to change color
*				  On hover
* RETURN       : None.
* NOTES        : Polymorphic function - inherited from Widget.
* -------------------------------------------------------------------- */
void ComboBox::Draw_Color(COORD CursorPosition,const HANDLE& console) {
	strVecItr itr = _comboNames.begin();
	while (itr != _comboNames.end())
	{
		_isOpen = false;
		if (itr->index == _current)
			DrawItem(CursorPosition, console, itr, true);
		else
			DrawItem(CursorPosition, console, itr, false);
		CursorPosition.Y += 2;
		++itr;
	}
}
开发者ID:GolanSabo,项目名称:Shenkar,代码行数:20,代码来源:ComboBox.cpp

示例9: PrintString

void AGameplayDebuggingHUDComponent::DrawEQSItemDetails(int32 ItemIdx, class UGameplayDebuggingComponent *DebugComponent)
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) && WITH_EQS
	const float PosY = DefaultContext.CursorY + 1.0f;
	float PosX = DefaultContext.CursorX;

	const int32 EQSIndex = DebugComponent->EQSLocalData.Num() > 0 ? FMath::Clamp(DebugComponent->CurrentEQSIndex, 0, DebugComponent->EQSLocalData.Num() - 1) : INDEX_NONE;
	auto& CurrentLocalData = DebugComponent->EQSLocalData[EQSIndex];
	const EQSDebug::FItemData& ItemData = CurrentLocalData.Items[ItemIdx];

	PrintString(DefaultContext, FColor::White, ItemData.Desc, PosX, PosY);
	PosX += ItemDescriptionWidth;

	FString ScoreDesc = FString::Printf(TEXT("%.2f"), ItemData.TotalScore);
	PrintString(DefaultContext, FColor::Yellow, ScoreDesc, PosX, PosY);
	PosX += ItemScoreWidth;

	FCanvasTileItem ActiveTileItem(FVector2D(0, PosY + 15.0f), GWhiteTexture, FVector2D(0, 2.0f), FLinearColor::Yellow);
	FCanvasTileItem BackTileItem(FVector2D(0, PosY + 15.0f), GWhiteTexture, FVector2D(0, 2.0f), FLinearColor(0.1f, 0.1f, 0.1f));
	const float BarWidth = 80.0f;

	const int32 NumTests = ItemData.TestScores.Num();

	float TotalWeightedScore = 0.0f;
	for (int32 Idx = 0; Idx < NumTests; Idx++)
	{
		TotalWeightedScore += ItemData.TestScores[Idx];
	}

	for (int32 Idx = 0; Idx < NumTests; Idx++)
	{
		const float ScoreW = ItemData.TestScores[Idx];
		const float ScoreN = ItemData.TestValues[Idx];
		FString DescScoreW = FString::Printf(TEXT("%.2f"), ScoreW);
		FString DescScoreN = (ScoreN == UEnvQueryTypes::SkippedItemValue) ? TEXT("SKIP") : FString::Printf(TEXT("%.2f"), ScoreN);
		FString TestDesc = DescScoreW + FString(" {LightBlue}") + DescScoreN;

		float Pct = (TotalWeightedScore > KINDA_SMALL_NUMBER) ? (ScoreW / TotalWeightedScore) : 0.0f;
		ActiveTileItem.Position.X = PosX;
		ActiveTileItem.Size.X = BarWidth * Pct;
		BackTileItem.Position.X = PosX + ActiveTileItem.Size.X;
		BackTileItem.Size.X = FMath::Max(BarWidth * (1.0f - Pct), 0.0f);

		DrawItem(DefaultContext, ActiveTileItem, ActiveTileItem.Position.X, ActiveTileItem.Position.Y);
		DrawItem(DefaultContext, BackTileItem, BackTileItem.Position.X, BackTileItem.Position.Y);

		PrintString(DefaultContext, FColor::Green, TestDesc, PosX, PosY);
		PosX += TestScoreWidth;
	}
#endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST) && WITH_EQS
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:51,代码来源:GameplayDebuggingHUDComponent.cpp

示例10: PaintColumn

static void PaintColumn(HDC hDC, HDC arrow, MENUITEM *items, MENUITEM *selected, int x, int y, HFONT font, int fontHeight)
{
    MENUITEM *orig = items;
    int width = CalculateMenuWidth(hDC, items) + 28;
    int pos = y;
    BOOL submenu = FALSE;
    while (items)
    {
        DrawItem(hDC, items->text, selected == items,COLOR_BTNFACE, x, pos, width, fontHeight);
        if (items->popup)
        {
            if (items->expanded)
                submenu = TRUE;
            BitBlt(hDC, x + width - 10, pos + (fontHeight - 8)/2, 8,8,arrow, 0, 0, SRCCOPY);
        }
        pos += fontHeight;
        items = items->next;
    }
    if (submenu)
    {
   
        items = orig;
        pos = y;
        while (items)
        {
            if (items->popup && items->expanded)
            {
                PaintColumn(hDC, arrow, items->popup, selected, x+width, pos, font, fontHeight);
            }
            pos += fontHeight;
            items = items->next;
        }
    }
    else
    {
        DrawItem(hDC, L"<---->", FALSE, COLOR_WINDOW, x, pos, width, fontHeight);
        items = orig;
        pos = y;
        while (items)
        {
            if (items->expanded)
            {
                DrawItem(hDC, L"<---->", FALSE, COLOR_WINDOW, x+width, pos, width, fontHeight);
            }
            pos += fontHeight;
            items = items->next;
        }
    }
}
开发者ID:jossk,项目名称:OrangeC,代码行数:49,代码来源:drawmenu.c

示例11: gc

	bool PopupMenu::SetSelected( int n )
	{
		if ( n == selected ) { return true; }

		if ( n < 0 || n > list.count() || IsSplit( n ) ) { return false; }

		if ( sub.ptr() ) { sub.clear(); }

		int old = selected;
		selected = n;
		GC gc( this );
		DrawItem( gc, old );
		DrawItem( gc, selected );
		return true;
	}
开发者ID:0-wiz-0,项目名称:WCMCommander,代码行数:15,代码来源:swl_popupmenu.cpp

示例12: memset

void CPmwStatusBar::DoPaint(CDC* pDC)
{
   INHERITED::DoPaint(pDC);

	if (m_nCount > 1)
	{
		DRAWITEMSTRUCT dis;

		memset(&dis, 0, sizeof(dis));

		dis.hwndItem = GetSafeHwnd();
		dis.hDC = pDC->m_hDC;

		for (dis.itemID = 1; dis.itemID <= 3; dis.itemID++)
		{
			UINT uStyle;
			int nWidth;

			// Get the pane info to get the ID.
			GetPaneInfo(dis.itemID, dis.CtlID, uStyle, nWidth);

			// Get the item rect.
			GetItemRect(dis.itemID, &dis.rcItem);

			// If we need to draw this item, do it now.
			if (::RectVisible(pDC->m_hDC, &dis.rcItem))
			{
				DrawItem(&dis);
			}
		}
	}
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:32,代码来源:STATBAR.CPP

示例13: ItemHeight

void ScrolledListView::Draw(BRect updateRect)
{
	// figure out which items we're drawing
	float itemHeight = ItemHeight();
	int32 firstItem = (int) (updateRect.top / itemHeight);
	if (firstItem < 0)
		firstItem = 0;
	int32 lastItem = (int) ((updateRect.bottom + itemHeight - 1) / itemHeight);
	int32 numItems = NumItems();
	if (lastItem >= numItems)
		lastItem = numItems - 1;

	// draw
	BRect itemRect = Bounds();
	itemRect.top = firstItem * itemHeight;
	itemRect.bottom = itemRect.top + itemHeight - 1;
	for (int32 i=firstItem; i <= lastItem; i++) {
		// draw item
		DrawItem(i, itemRect, i == selection);

		// bump itemRect
		itemRect.top = itemRect.bottom + 1;
		itemRect.bottom = itemRect.top + itemHeight - 1;
		}

	// clear any left-over area
	if (itemRect.top < updateRect.bottom) {
		itemRect.bottom = updateRect.bottom;
		FillRect(itemRect, B_SOLID_LOW);
		}
}
开发者ID:HaikuArchives,项目名称:Item,代码行数:31,代码来源:ScrolledListView.cpp

示例14: GetClient

void CDuiListBox::RedrawItem(int iItem)
{
    if(!IsVisible(TRUE)) return;

    CRect rcClient;
    GetClient(&rcClient);
    int iFirstVisible = GetTopIndex();
    int nPageItems=(rcClient.Height()+m_nItemHei-1)/m_nItemHei+1;

    if(iItem>=iFirstVisible && iItem<GetCount() && iItem<iFirstVisible+nPageItems)
    {
        CRect rcItem(0,0,rcClient.Width(),m_nItemHei);
        rcItem.OffsetRect(0,m_nItemHei*iItem-m_ptOrigin.y);
        rcItem.OffsetRect(rcClient.TopLeft());
        CDCHandle dc=GetDuiDC(&rcItem,OLEDC_PAINTBKGND);
        DuiDCPaint duiDC;
        BeforePaint(dc,duiDC);

        DuiSendMessage(WM_ERASEBKGND,(WPARAM)(HDC)dc);
        DrawItem(dc,rcItem,iItem);

        AfterPaint(dc,duiDC);
        ReleaseDuiDC(dc);
    }
}
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:25,代码来源:duilistbox.cpp

示例15: switch

BOOL CComboBox::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam,
	LRESULT* pResult)
{
	switch (message)
	{
	case WM_DRAWITEM:
		ASSERT(pResult == NULL);       // no return value expected
		DrawItem((LPDRAWITEMSTRUCT)lParam);
		break;
	case WM_MEASUREITEM:
		ASSERT(pResult == NULL);       // no return value expected
		MeasureItem((LPMEASUREITEMSTRUCT)lParam);
		break;
	case WM_COMPAREITEM:
		ASSERT(pResult != NULL);       // return value expected
		*pResult = CompareItem((LPCOMPAREITEMSTRUCT)lParam);
		break;
	case WM_DELETEITEM:
		ASSERT(pResult == NULL);       // no return value expected
		DeleteItem((LPDELETEITEMSTRUCT)lParam);
		break;
	default:
		return CWnd::OnChildNotify(message, wParam, lParam, pResult);
	}
	return TRUE;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:26,代码来源:winctrl1.cpp


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