Posts

Showing posts with the label mfc

Adding statusbar to CDialog and setting control positions correctly

Image
Adding statusbar to CDialog and setting control positions correctly So, I have a CDialog resource that I have had for a long time and I decided to add a statusbar to it. Here is the resource: CDialog All controls fit nicely in the dialog. Now, at runtime this is what it looks like: The tutorial I followed was here and for the most part it works. Here is my setup code: /////////////////////////////// m_StatusBar.Create(this); //We create the status bar m_StatusBar.SetIndicators(indicators, 2); //Set the number of panes CRect rect; GetClientRect(&rect); //Size the two panes m_StatusBar.SetPaneInfo(0, ID_INDICATOR_DATE, SBPS_NORMAL, 200); m_StatusBar.SetPaneInfo(1, ID_INDICATOR_MEETING_TYPE, SBPS_STRETCH, 0); //This is where we actually draw it on the screen RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, ID_INDICATOR_DATE); GetDynamicLayout()->AddItem(m_StatusBar.GetSafeHwnd(), CMFCDynamicLayout::MoveVertical(100), CMFCDynamicLayout::SizeHorizontal(1...