示例#1
0
void CMainFrame::SetupToolBar()
{
	// Define our toolbar data
	AddToolBarButton( IDM_FILE_NEW  , FALSE, _T("New") );
	AddToolBarButton( IDM_FILE_OPEN , FALSE, _T("Open") );
	AddToolBarButton( IDM_FILE_SAVE , FALSE, _T("Save") );
	
	AddToolBarButton( 0 );	// Separator
	AddToolBarButton( IDM_EDIT_CUT  , FALSE, _T("Cut") );
	AddToolBarButton( IDM_EDIT_COPY , FALSE, _T("Copy") );
	AddToolBarButton( IDM_EDIT_PASTE, FALSE, _T("Paste") );
	AddToolBarButton( IDM_FILE_PRINT, FALSE, _T("Print") );
	
	AddToolBarButton( 0 );	// Separator
	AddToolBarButton( IDM_VIEWMENU,   TRUE,  _T("View Menu"));
	
	AddToolBarButton( 0 );	// Separator
	AddToolBarButton( IDM_HELP_ABOUT, TRUE,  _T("About") );

	// Use larger buttons
	SetToolBarImages(RGB(192,192,192), IDB_TOOLBAR_NORM, IDB_TOOLBAR_HOT, IDB_TOOLBAR_DIS);

	// Configure the ViewMenu button to bring up a menu
	// Setting this style requires comctl32.dll version 4.72 or later
	if (GetComCtlVersion() >= 472)
	{
		CToolBar& TB = GetToolBar();
		TB.SetButtonStyle(IDM_VIEWMENU, BTNS_WHOLEDROPDOWN);
	}
}
示例#2
0
void CMainFrame::OnTBBigIcons()
// Toggle the Image size for the ToolBar by changing Image Lists.
{
	m_UseBigIcons = !m_UseBigIcons;

	GetFrameMenu()->CheckMenuItem(IDM_TOOLBAR_BIGICONS, MF_BYCOMMAND | (m_UseBigIcons ? MF_CHECKED : MF_UNCHECKED));

	if (m_UseBigIcons)
	{
		// Set Large Images. 3 Imagelists - Normal, Hot and Disabled
		SetToolBarImages(RGB(192,192,192), IDB_NORMAL, IDB_HOT, IDB_DISABLED);
	}
	else
	{
		// Set Small icons
		SetToolBarImages(RGB(192,192,192), IDW_MAIN, 0, 0);
	}

	RecalcLayout();
	GetToolBar()->Invalidate();
}
示例#3
0
void CMainFrame::SetupToolBar()
{
	// Set the Resource IDs for the first toolbar buttons
	AddToolBarButton( IDM_FILE_NEW   );
	AddToolBarButton( IDM_FILE_OPEN  );
	AddToolBarButton( 0 );				// Separator
	AddToolBarButton( IDM_FILE_SAVE  );
	AddToolBarButton( 0 );				// Separator
	AddToolBarButton( IDM_EDIT_CUT   );
	AddToolBarButton( IDM_EDIT_COPY  );
	AddToolBarButton( IDM_EDIT_PASTE );
	AddToolBarButton( 0 );				// Separator
	AddToolBarButton( IDM_FILE_PRINT );
	AddToolBarButton( 0 );				// Separator
	AddToolBarButton( IDM_HELP_ABOUT );

	// Set the three image lists for the first toolbar
	SetToolBarImages(RGB(255, 0, 255), IDB_TOOLBAR_NORM, IDB_TOOLBAR_HOT, IDB_TOOLBAR_DIS);

	// Add the two other toolbars if we can use rebars (Need Win95 and IE 4 or better)
	if (IsReBarSupported())
	{
		// Add the Arrows toolbar
		AddToolBarBand(&m_Arrows, 0, IDC_ARROWS);
		m_Arrows.AddButton(IDM_ARROW_LEFT);
		m_Arrows.AddButton(IDM_ARROW_RIGHT);

		// Add the Cards toolbar
		AddToolBarBand(&m_Cards, 0, IDB_CARDS);
		m_Cards.AddButton(IDM_CARD_CLUB);
		m_Cards.AddButton(IDM_CARD_DIAMOND);
		m_Cards.AddButton(IDM_CARD_HEART);
		m_Cards.AddButton(IDM_CARD_SPADE);
		
		// Set the button images
		SetTBImageList(&m_Arrows, &m_ArrowImages, IDB_ARROWS, RGB(255,0,255));
		SetTBImageList(&m_Cards, &m_CardImages, IDB_CARDS, RGB(255,0,255));
	}

	AddCombo();
}