Home > Software engineering >  How to hide the scroll bar ws_hscroll window properties have
How to hide the scroll bar ws_hscroll window properties have

Time:11-21

MSDN says ws_hscroll attributes cannot be removed after the form is created, so modifystyle, flow for the setwindowlongptr don't want to, then there is a kind of method is to call in onnccalcsize showscrollbar (SB_BOTH, FALSE); This method is feasible, but it seems like I don't want to logic, this is when the form changes to recalculate the location, the showscrollbar function doesn't work in other place, which bosses about why ah, I want to take the initiative to hide the scroll bar, not only in the onnccalcsize

CodePudding user response:

"Position is when the form is changed to recalculate the position"
Window to create success for the first time after the show also is such, such as:
Void CMaxListCtrlDlg: : OnSize (UINT nType, cx, int int cy)
{
CDialog: : OnSize (cx, nType, cy);
If (nType==SIZE_MAXIMIZED)
{
AfxDump & lt; }
If (IsWindow (m_ctrlList))
{
CRect rc;
GetClientRect (& amp; Rc);
//modify column width
M_ctrlList. SetColumnWidth (1, rc. Width ());//LVSCW_AUTOSIZE_USEHEADER);//- 2
M_ctrlList. MoveWindow (& amp; Rc);
m_ctrlList. ShowScrollBar (SB_HORZ, FALSE);//must after MoveWindow
}
//TODO: Add your message handler code here
}

CodePudding user response:

reference 1st floor schlafenhamster response:
"position is when the form is changed to recalculate the position"
Window to create success for the first time after the show also is such, such as:
Void CMaxListCtrlDlg: : OnSize (UINT nType, cx, int int cy)
{
CDialog: : OnSize (cx, nType, cy);
If (nType==SIZE_MAXIMIZED)
{
AfxDump & lt; }
If (IsWindow (m_ctrlList))
{
CRect rc;
GetClientRect (& amp; Rc);
//modify column width
M_ctrlList. SetColumnWidth (1, rc. Width ());//LVSCW_AUTOSIZE_USEHEADER);//- 2
M_ctrlList. MoveWindow (& amp; Rc);
m_ctrlList. ShowScrollBar (SB_HORZ, FALSE);//must after MoveWindow
}
//TODO: Add your message handler code here
}
with a guy, I want to be a member function to invoke this in the outside,

CodePudding user response:

Direct call
Cx, OnSize (UINT nType, int int cy)

CodePudding user response:

The
reference 3 floor schlafenhamster response:
direct call
Cx, OnSize (UINT nType, int int cy)
with a guy only OnNcCalcSize useful not just tried it on

CodePudding user response:

M_ctrlList. MoveWindow (& amp; Rc);
M_ctrlList. ShowScrollBar (SB_HORZ, FALSE);// must after MoveWindow
  • Related