Esempio n. 1
0
void CMainFrame::OnViewCustomize() 
{
	CWordPadView* pView = DYNAMIC_DOWNCAST (CWordPadView, GetActiveView());
	if (pView != NULL && pView->GetInPlaceActiveItem () != NULL)
	{
		return;
	}

	//------------------------------------
	// Create a customize toolbars dialog:
	//------------------------------------
	CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog (this,
		TRUE /* Automatic menus scaning */,
		AFX_CUSTOMIZE_MENU_SHADOWS | AFX_CUSTOMIZE_TEXT_LABELS | 
		AFX_CUSTOMIZE_MENU_ANIMATIONS);

	pDlgCust->AddToolBar (_T("Format"), IDR_FORMATBAR);

	CMFCToolBarFontComboBox* pFontButton = m_wndFormatBar.CreateFontComboButton ();
	pDlgCust->ReplaceButton (IDC_FONTNAME, *pFontButton);
	delete pFontButton;

	CMFCToolBarFontSizeComboBox comboButtonFontSize (IDC_FONTSIZE, 
		GetCmdMgr ()->GetCmdImage (IDC_FONTSIZE, FALSE),
		WS_TABSTOP|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|CBS_DROPDOWN,
		10*m_wndFormatBar.m_szBaseUnits.cx + 10);
	pDlgCust->ReplaceButton (IDC_FONTSIZE, comboButtonFontSize);

	CMFCColorMenuButton* pColorButton = m_wndFormatBar.CreateColorButton ();
	pDlgCust->ReplaceButton (ID_CHAR_COLOR, *pColorButton);
	delete pColorButton;

	CMFCToolBarMenuButton* pBorderTypeButton = m_wndFormatBar.CreateBorderTypeButton ();
	pDlgCust->ReplaceButton (ID_BORDER_1, *pBorderTypeButton);
	delete pBorderTypeButton;

	pDlgCust->EnableUserDefinedToolbars ();
	pDlgCust->Create ();
}
Esempio n. 2
0
void CMainFrame::OnViewCustomize()
{
	//------------------------------------
	// Create a customize toolbars dialog:
	//------------------------------------
	CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog (this,
		TRUE /* Automatic menus scaning */
		);

	//----Example----//

	CMFCToolBarDateTimeCtrl dateButton (ID_DATE,
		GetCmdMgr ()->GetCmdImage (ID_DATE, FALSE));
	pDlgCust->ReplaceButton (ID_DATE, dateButton);

	CMFCToolBarDateTimeCtrl timeButton (ID_TIME,
		GetCmdMgr ()->GetCmdImage (ID_TIME, FALSE),
		DTS_TIMEFORMAT | DTS_UPDOWN);
	pDlgCust->ReplaceButton (ID_TIME, timeButton);

	//----Example----//

	pDlgCust->Create ();
}