Aracılığıyla paylaş


CMFCColorMenuButton sınıfı

CMFCColorMenuButton Sınıfı, bir menü komutuna ya da Renk Seçici iletişim kutusunda başlayan bir araç çubuğu düğmesi destekler.

class CMFCColorMenuButton : public CMFCToolBarMenuButton

Üyeler

Bb983045.collapse_all(tr-tr,VS.110).gifOrtak Oluşturucusu

Ad

Description

CMFCColorMenuButton::CMFCColorMenuButton

Yapıları bir CMFCColorMenuButton nesnesi.

Bb983045.collapse_all(tr-tr,VS.110).gifPublic yöntemler

Ad

Description

CMFCColorMenuButton::EnableAutomaticButton

Etkinleştirir ve normal renkli düğmeler yerleştirilmiş bir "Otomatik" düğmesini devre dışı bırakır.(Standart sistem otomatik düğme etiketini Otomatik.)

CMFCColorMenuButton::EnableDocumentColors

Belgeye özel renk sistemi renkleri yerine görüntülenmesini sağlar.

CMFCColorMenuButton::EnableOtherButton

Normal renkli düğmeler yerleştirilmiş bir "diğer" düğmesini devre dışı bırakır ve etkinleştirir.("Diğer" düğme etiketlenir standart sistem Daha fazla renk....)

CMFCColorMenuButton::EnableTearOff

Renk Bölmesi kapalı tear olanağı sağlar.

CMFCColorMenuButton::GetAutomaticColor

Geçerli otomatik renk alır.

CMFCColorMenuButton::GetColor

Geçerli düğmenin rengini alır.

CMFCColorMenuButton::GetColorByCmdID

Belirtilen komut kimliğine karşılık gelen renk alır.

CMFCColorMenuButton::OnChangeParentWnd

Ana pencere değiştiğinde çerçevesi tarafından çağrıldı.

CMFCColorMenuButton::OpenColorDialog

Renk seçimi iletişim kutusunu açar.

CMFCColorMenuButton::SetColor

Geçerli rengi düğmesinin rengini ayarlar.

CMFCColorMenuButton::SetColorByCmdID

Belirtilen renk menü düğmesinin rengini ayarlar.

CMFCColorMenuButton::SetColorName

Belirtilen renk için yeni bir ad belirler.

CMFCColorMenuButton::SetColumnsNumber

Tarafından görüntülenen sütun sayısını ayarlar bir CMFCColorBar nesnesi.

Bb983045.collapse_all(tr-tr,VS.110).gifKorumalı yöntemleri

Ad

Description

CMFCColorMenuButton::CopyFrom

Başka bir araç çubuğu düğmesi geçerli düğme kopyalar.

CMFCColorMenuButton::CreatePopupMenu

Renk Seçicisi iletişim kutusu oluşturur.

CMFCColorMenuButton::IsEmptyMenuAllowed

Boş menüleri desteklenip desteklenmediğini gösterir.

CMFCColorMenuButton::OnDraw

Düğme görüntüyü görüntülemek için çerçeve tarafından çağrıldı.

CMFCColorMenuButton::OnDrawOnCustomizeList

Önce framework tarafından çağrılan bir CMFCColorMenuButton nesne araç çubuğunu özelleştirme iletişim kutusu listesinde görüntülenir.

Notlar

Orijinal menü komutu veya araç çubuğu düğmesi ile değiştirmek için bir CMFCColorMenuButton nesne, oluşturmak CMFCColorMenuButton herhangi bir uygun set nesnesinin, CMFCColorBar sınıfı stilleri ve ardından arama ReplaceButton yöntemi, CMFCToolBar sınıfı sınıfı.Bir araç çubuğunu özelleştirmek, çağrı CMFCToolBarsCustomizeDialog::ReplaceButton yöntemi.

Renk Seçici iletişim kutusunda, işlenmesi sırasında oluşturulan CMFCColorMenuButton::CreatePopupMenu olay işleyicisi.Olay işleyicisi olan ana kare bildirir bir WM_COMMAND ileti.CMFCColorMenuButton Nesne orijinal menü komutu veya araç çubuğu düğmesi için atanan denetim kimliği gönderir.

Örnek

Aşağıdaki örnek, nasıl oluşturulacağı ve renkli menü düğmesi, çeşitli yöntemleri kullanarak yapılandırma gösterir CMFCColorMenuButton sınıfı.Örnekte, bir CPalette nesnesini ilk oluşturduğunuz ve bir nesne oluşturmak için kullanılan CMFCColorMenuButton sınıfı.CMFCColorMenuButton Nesnesi daha sonra yapılandırılan kendi otomatik ve diğer düğmeleri etkinleştirme ve rengi ve sütunların sayısını ayarlama.Bu kod parçası olan Word Pad örnek.

    CPalette    m_palColorPicker;   // Palette for color picker
    int         m_nNumColours;


...


CMFCColorMenuButton* CFormatBar::CreateColorButton ()
{
    if (m_palColorPicker.GetSafeHandle () == NULL)
    {
        m_nNumColours = sizeof (crColours)/sizeof(ColourTableEntry);
        ASSERT(m_nNumColours <= MAX_COLOURS);
        if (m_nNumColours > MAX_COLOURS)
            m_nNumColours = MAX_COLOURS;

        // Create the palette
        struct 
        {
            LOGPALETTE    LogPalette;
            PALETTEENTRY  PalEntry[MAX_COLOURS];
        }pal;

        LOGPALETTE* pLogPalette = (LOGPALETTE*) &pal;
        pLogPalette->palVersion    = 0x300;
        pLogPalette->palNumEntries = (WORD) m_nNumColours; 

        for (int i = 0; i < m_nNumColours; i++)
        {
            pLogPalette->palPalEntry[i].peRed   = GetRValue(crColours[i].crColour);
            pLogPalette->palPalEntry[i].peGreen = GetGValue(crColours[i].crColour);
            pLogPalette->palPalEntry[i].peBlue  = GetBValue(crColours[i].crColour);
            pLogPalette->palPalEntry[i].peFlags = 0;
        }

        m_palColorPicker.CreatePalette (pLogPalette);
    }


    CMFCColorMenuButton* pColorButton = new 
        CMFCColorMenuButton (ID_CHAR_COLOR, _T("Text Color..."), &m_palColorPicker);

    pColorButton->EnableAutomaticButton (_T("Automatic"), RGB (0, 0, 0));
    pColorButton->EnableOtherButton (_T("More Colors..."));
    pColorButton->EnableDocumentColors (_T("Document's Colors"));
    pColorButton->EnableTearOff (ID_COLOR_TEAROFF, 5, 2);
    pColorButton->SetColumnsNumber (8);
    pColorButton->SetColor(RGB(0,0,255));

    // Initialize color names:
    for (int i = 0; i < m_nNumColours; i++)
    {
        CMFCColorMenuButton::SetColorName (crColours[i].crColour, crColours[i].szName);
    }

    return pColorButton;
}

Devralma hiyerarşisi

CObject

   CMFCToolBarButton

      CMFCToolBarMenuButton

         CMFCColorMenuButton

Gereksinimler

Başlık: afxcolormenubutton.h

Ayrıca bkz.

Başvuru

Hiyerarşi grafik

CMFCColorBar sınıfı

CMFCToolBar sınıfı

CMFCToolBarsCustomizeDialog sınıfı

CMFCColorButton sınıfı

Diğer Kaynaklar

mfc sınıfları