Home > Software engineering >  ScrollWindow don't roll
ScrollWindow don't roll

Time:09-24

Edit box, let it automatically roll to the bottom, associated a CEdit object, use LineScroll can scroll so
 m_edit. The SetWindowText (m_LogString); 
M_edit. LineScroll (m_edit GetLineCount ());

In one way:
 the UpdateData (FALSE); 
Int minPos, maxPos curPos;
GetDlgItem (IDC_EDIT1) - & gt; GetScrollRange (SB_VERT, & amp; MinPos, & amp; MaxPos);
CurPos=GetDlgItem (IDC_EDIT1) - & gt; GetScrollPos (SB_VERT);
GetDlgItem (IDC_EDIT1) - & gt; SetScrollPos (SB_VERT maxPos);
GetDlgItem (IDC_EDIT1) - & gt; The ScrollWindow (0, curPos - maxPos);
GetDlgItem (IDC_EDIT1) - & gt; UpdateWindow ();

This will not be able to scroll, only to see changes in the edit box button, this should be how to do?

CodePudding user response:

Behind this operation is the form, the operation is in front of the edit box, not the same

CodePudding user response:

ScrollWindow edit is the parent of the function, is not appropriate edit
Try:
Void CDrawEditDlg: : OnButton2 ()
{//
//TODO: Add your the control notification handler code here
Int lineHeight=20;// device unit
GetDlgItem (IDC_EDIT1) - & gt; ScrollWindow (0 - lineHeight);
//the redraw dialog!
Invalidate ().
UpdateWindow ();
}

CodePudding user response:

Suggest tracking debugging, see the specific reason!

CodePudding user response:

Send EM_LINESCROLL


CodePudding user response:

ScrollWindow should not change the window Scroll Info, it just put the content on the DC rolling, and then change the coordinates of traverse to the child window,
  • Related