MFC Ribbon - alignment issue(s)
Asked Answered
U

0

6

Create a standard App with ribbon, then add this to the CMainFrame::InitializeRibbon() at the appropriate place.

// Create panel

CMFCRibbonPanel* pMyPanel = pCategory->AddPanel(L"Test", m_PanelImages.ExtractIcon(27));

// Add wide combobox with short label to panel

m_pMyCombo = new CMFCRibbonComboBox(ID_MYCOMBO, false, 150, L"Short:");
m_pMyCombo->AddItem(L"Just some test data");
pMyPanel->Add(m_pMyCombo);

// Add narrow edit with longer label to panel.

CMFCRibbonEdit* pMyEdit = new CMFCRibbonEdit(ID_MYEDIT, 50, L"Longer label:");
pMyPanel->Add(pMyEdit);

Issue 1: The combobox "sticks" to the top of the panel. The edit control "sticks" to the combobox. There is about 1/3 of the height unused.

Is there a way to make these 2 controls use the full height ? I can use pMyPanel->SetCenterColumnVert(); But the 2 controls are still stuck together although they're now vertically centered. What I'm really after is that there is more or less even spacing above and below the controls.

Issue 2: this looks like

Short: [______________________|v]
Longer label: [___]

which isn't really looking nice.

I can call SetJustifyColums() but this results in

Short: [______________________|v]
Longer label: [___]

which may seem OK enough, but if the length of the labels reverses it gives:

Longer label: [______________________|v]
Short: [___]

which isn't really looking OK.

I'd really like to get this to like you'd normally make a dialog. Labels left aligned and controls left aligned also.

Short: [______________________|v]
Longer label: [___]

How can these issues be solved?

Unmask answered 12/9, 2013 at 6:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.