65.9K
CodeProject 正在变化。 阅读更多。
Home

使用 eGui 库实现的 Apple 风格对接栏

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.21/5 (10投票s)

2007 年 12 月 22 日

CPOL
viewsIcon

38050

downloadIcon

1197

使用 eGui 库实现的 Apple 风格对接栏

Screenshot -

引言

使用 eGUI 控件库,您可以轻松实现 Apple 风格的停靠栏。在这里我介绍一些实现此栏的代码。您可以访问 eGui 项目 了解更多关于 eGUI 项目和 eGui 库源代码的信息。

Using the Code

eGUI 提供了一个 CBarWidget 用于实现此功能。使用以下步骤可以轻松使用它

void CMainMenuView::TestBarWidget()
{
int nItems=8;
//Create a CBarWidget
CBarWidget* pBarWidget = new CBarWidget();
m_pBarWidget=pBarWidget;
//Listen to the CBarWidget's event
this->m_pBarWidget->GetEventModel()->AddListener(this->GetEventListener());
pBarWidget->SetBackgroundColor(RGB(216,233,226));
//Insert the CBarWidget into container.
this->m_pRootContainer->InsertWidget(pBarWidget);
WRect rc;
this->m_pRootContainer->GetRect(&rc);
rc.x=0;
rc.y=rc.dy-100;
rc.dy=150;
//Set Bar Widget's size, note which will be re-sized automatically if you add more items.
pBarWidget->SetRect(&rc);
//Use a for loop to add the CImageWidget as the item.
//note, the item can be any type widget.
char draw_cmd[128];
char img_fn[128];
CImageWidget* pImageWidget = NULL;
rc.dy=48;
rc.dx=48;
WRect rcW;
for(int i=0;i

历史

  • 2007年12月22日:初始发布
© . All rights reserved.