Condividi tramite


Classe CMFCRibbonButton

La classe CMFCRibbonButton implementa i pulsanti che è possibile posizionare gli elementi della barra multifunzione nei pannelli, le barre di accesso rapido e menu di scelta rapida.

class CMFCRibbonButton : public CMFCRibbonBaseElement

Membri

Costruttori pubblici

Nome

Descrizione

CMFCRibbonButton::CMFCRibbonButton

Costruisce un oggetto pulsante della barra multifunzione.

Metodi pubblici

Nome

Descrizione

CMFCRibbonButton::AddSubItem

Aggiunge una voce al menu di scelta rapida associato al pulsante.

CMFCRibbonButton::CanBeStretched

  (Override CMFCRibbonBaseElement::CanBeStretched).

CMFCRibbonButton::CleanUpSizes

  (Override CMFCRibbonBaseElement::CleanUpSizes).

CMFCRibbonButton::ClosePopupMenu

  (Override CMFCRibbonBaseElement::ClosePopupMenu).

CMFCRibbonButton::DrawBottomText

 

CMFCRibbonButton::DrawImage

  (Override CMFCRibbonBaseElement::DrawImage).

CMFCRibbonButton::DrawRibbonText

 

CMFCRibbonButton::FindSubItemIndexByID

Restituisce l'indice di una voce di menu di scelta rapida associato all'ID di comando

CMFCRibbonButton::GetCommandRect

 

CMFCRibbonButton::GetCompactSize

Restituisce la dimensione compressa dell'elemento barra multifunzione. (Override CMFCRibbonBaseElement::GetCompactSize).

CMFCRibbonButton::GetIcon

 

CMFCRibbonButton::GetImageIndex

Restituisce l'indice dell'immagine associata al pulsante.

CMFCRibbonButton::GetImageSize

Restituisce le dimensioni dell'elemento barra multifunzione. (Override CMFCRibbonBaseElement::GetImageSize).

CMFCRibbonButton::GetIntermediateSize

Restituisce la dimensione elemento della barra multifunzione nello stato temporaneo. (Override CMFCRibbonBaseElement::GetIntermediateSize).

CMFCRibbonButton::GetMenu

Restituisce un handle a un menu di Windows assegnato al pulsante della barra multifunzione.

CMFCRibbonButton::GetMenuRect

 

CMFCRibbonButton::GetRegularSize

Restituisce la dimensione normale dell'elemento barra multifunzione. (Override CMFCRibbonBaseElement::GetRegularSize).

CMFCRibbonButton::GetSubItems

 

CMFCRibbonButton::GetTextRowHeight

 

CMFCRibbonButton::GetToolTipText

Testo di descrizione comandi viene restituito dell'elemento barra multifunzione. (Override CMFCRibbonBaseElement::GetToolTipText).

CMFCRibbonButton::HasCompactMode

Specifica se l'elemento barra multifunzione presenta una modalità compressa. (Override CMFCRibbonBaseElement::HasCompactMode).

CMFCRibbonButton::HasIntermediateMode

Specifica se l'elemento barra multifunzione presenta una modalità intermedia. (Override CMFCRibbonBaseElement::HasIntermediateMode).

CMFCRibbonButton::HasLargeMode

Determina se l'elemento barra multifunzione presenta un modo efficace. (Override CMFCRibbonBaseElement::HasLargeMode).

CMFCRibbonButton::HasMenu

  (Override CMFCRibbonBaseElement::HasMenu).

CMFCRibbonButton::IsAlwaysDrawBorder

 

CMFCRibbonButton::IsAlwaysLargeImage

  (Override CMFCRibbonBaseElement::IsAlwaysLargeImage).

CMFCRibbonButton::IsApplicationButton

 

CMFCRibbonButton::IsCommandAreaHighlighted

 

CMFCRibbonButton::IsDefaultCommand

Determina se è stato attivato il comando predefinito per un pulsante della barra multifunzione.

CMFCRibbonButton::IsDefaultPanelButton

 

CMFCRibbonButton::IsDrawTooltipImage

 

CMFCRibbonButton::IsLargeImage

 

CMFCRibbonButton::IsMenuAreaHighlighted

 

CMFCRibbonButton::IsMenuOnBottom

 

CMFCRibbonButton::IsPopupDefaultMenuLook

 

CMFCRibbonButton::IsRightAlignMenu

Determina se il menu è allineato a destra.

CMFCRibbonButton::IsSingleLineText

 

CMFCRibbonButton::OnCalcTextSize

  (Override CMFCRibbonBaseElement::OnCalcTextSize).

CMFCRibbonButton::OnDrawBorder

 

CMFCRibbonButton::OnDraw

Chiamato dal framework per disegnare l'elemento barra multifunzione. (Override CMFCRibbonBaseElement::OnDraw).

CMFCRibbonButton::OnFillBackground

 

CMFCRibbonButton::RemoveAllSubItems

Rimuove tutte le voci di menu dal menu di scelta rapida.

CMFCRibbonButton::RemoveSubItem

Rimuove una voce di menu dal menu di scelta rapida.

CMFCRibbonButton::SetACCData

  (Override CMFCRibbonBaseElement::SetACCData).

CMFCRibbonButton::SetAlwaysLargeImage

Specifica se il pulsante visualizza una grande o immagine piccola quando l'utente comprimere il pulsante.

CMFCRibbonButton::SetDefaultCommand

Abilita il comando predefinito per il pulsante della barra multifunzione.

CMFCRibbonButton::SetDescription

Imposta la descrizione per l'elemento barra multifunzione. (Override CMFCRibbonBaseElement::SetDescription).

CMFCRibbonButton::SetImageIndex

Assegna un valore all'immagine del pulsante.

CMFCRibbonButton::SetMenu

Assegna un menu di scelta rapida al pulsante della barra multifunzione.

CMFCRibbonButton::SetParentCategory

  (Override CMFCRibbonBaseElement::SetParentCategory).

CMFCRibbonButton::SetRightAlignMenu

Viene allineato il menu di scelta rapida a destra del pulsante.

CMFCRibbonButton::SetText

Imposta il testo per l'elemento barra multifunzione. (Override CMFCRibbonBaseElement::SetText).

Metodi protetti

Nome

Descrizione

CMFCRibbonButton::OnClick

Chiamato dal framework quando l'utente fa clic sul pulsante.

Esempio

Nell'esempio seguente viene illustrato come utilizzare i vari metodi della classe CMFCRibbonButton. L'esempio mostra come costruire un oggetto con la classe CMFCRibbonButton, assegnare un menu di scelta rapida al pulsante della barra multifunzione, impostare la descrizione del pulsante, rimuovere una voce di menu dal menu di scelta rapida e a destra allineare il menu di scelta rapida al bordo del pulsante.

    strTemp.LoadString(IDS_RIBBON_STYLE);
    // The first parameter is the command ID of the button. 
    // The third parameter is a zero-based index of the button's small image in the  
    // image list of the parent category. 
    // The fourth parameter is a zero-based index of the button's large image in the  
    // image list of the parent category.
    CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(1, strTemp, -1, -1);
    
    pVisualStyleButton->SetMenu(IDR_THEME_MENU, TRUE, TRUE);

    strTemp.LoadString(IDS_RIBBON_STYLE_TIP);
    pVisualStyleButton->SetToolTipText(strTemp);
    strTemp.LoadString(IDS_RIBBON_STYLE_DESC);
    pVisualStyleButton->SetDescription(strTemp);
    pVisualStyleButton->RemoveSubItem(0);
    pVisualStyleButton->SetRightAlignMenu(TRUE);

Note

Per utilizzare un pulsante della barra multifunzione in un'applicazione, costruire l'oggetto del pulsante e aggiungerlo alla barra multifunzione appropriata pannello.

CMFCRibbonPanel* pPanel = pCategory->AddPanel (
    _T("Clipboard"),                       // Panel name
    m_PanelIcons.ExtractIcon (0));  // Panel icon
// Create the first button ("Paste"):
CMFCRibbonButton* pPasteButton = 
    new CMFCRibbonButton (ID_EDIT_PASTE, _T("Paste"), -1, 0);
// The third parameter (-1) disables small images for button.
// This button is always displayed with a large image
// Associate a pop-up menu with the "Paste" button:
pPasteButton->SetMenu (IDR_CONTEXT_MENU);
// Add buttons to the panel. These buttons have only small images.
pPanel->Add (new CMFCRibbonButton (ID_EDIT_CUT, _T("Cut"), 1));
pPanel->Add (new CMFCRibbonButton (ID_EDIT_COPY, _T("Copy"), 2));
pPanel->Add (new CMFCRibbonButton (ID_EDIT_PAINT, _T("Paint"), 9));

Gerarchia di ereditarietà

CObject

   CMFCRibbonBaseElement

      CMFCRibbonButton

Requisiti

intestazione: afxribbonbutton.h

Vedere anche

Riferimenti

Grafico delle gerarchie

Altre risorse

Classi MFC