Search code examples
visual-c++wxwidgets

Expand wxStaticLine only horizontally


I have a wxWidget Application. I need to make certain changes to the layout of the application. One of them being adding horizontal lines between vertically stacked slider.

Here is the code I am using:

m_BrightContLine =new wxStaticLine(this,wxID_ANY,wxPoint(-10,10),wxSize(250,1),wxLI_HORIZONTAL,wxStaticLineNameStr);
gridSizer->Add(m_DummyText[16], 0, wxALL);
m_BCLineSizer = new wxBoxSizer(wxHORIZONTAL);
m_BCLineSizer->Add(m_BrightContLine, 1, wxALL|wxALIGN_LEFT|wxEXPAND);
gridSizer->Add(m_BCLineSizer, 0, wxALL|wxEXPAND);

the problem is that the static line expands both in length and in thickness.

How do I make sure that it expands only horizontally(in length).


Solution

  • Take out the wxEXPAND flag.

    m_BCLineSizer->Add(m_BrightContLine, 1, wxALL|wxALIGN_LEFT);
    

    If that doesn't work, try the wwxSHAPED flag

    m_BCLineSizer->Add(m_BrightContLine, 1, wxALL|wxALIGN_LEFT|wxSHAPED);