Home > Software engineering >  MFC edit box according to string a newline
MFC edit box according to string a newline

Time:11-14

Want to edit in MFC control implement each input line 15 characters, and allowed to enter at most 20 lines, help!!!!!!

CodePudding user response:

In the event of an edit control updates take take characters in length and up to 15 with a carriage return line feed \ n \ r,

CodePudding user response:

Enter the \ r \ n a new line

CodePudding user response:

A good youth learning MFC? Too waste, twenty years ago is already out of date

CodePudding user response:

reference weiwei_here reply: 3/f
good youth learning MFC? Too waste, twenty years ago is already out of date

Or specific treatment, in the first place to live, twenty years ago someone said, after 20 years don't exist?

CodePudding user response:

reference weiwei_here reply: 3/f
good youth learning MFC? Too waste, twenty years ago is already out of date

Company in use, to use a little now? QT?

CodePudding user response:

reference 5 floor Jeremaihivar reply:
Quote: refer to the third floor weiwei_here response:

A good youth learning MFC? Too waste, twenty years ago is already out of date

Company in use, to use a little now? QT?
Win32, Win32 can realize all the MFC, MFC to achieve all of the Win32

CodePudding user response:

refer to 4th floor to be continued _1006 response:
Quote: refer to the third floor weiwei_here response:

A good youth learning MFC? Too waste, twenty years ago is already out of date

Or specific treatment, in the first place to live, twenty years ago someone said, after 20 years don't exist?
said too right, oneself can't learn, they said went out twenty years ago, is reasonable, MFC may is larger than those who said old age, there are many different companies in use!

CodePudding user response:

Void CtesteditinputDlg: : OnEnChangeEdit1 ()
{//response EN_CHANGE events, attributes: Multiline=True (additional: to open the scroll bar on the right, open input Enter a newline)
Static int iRow=0;
Cstrings strText;
M_edit. GetWindowTextW (strText);
Int iLength=strText. GetLength ();

If (iLength==0) iRow=0;

//every 15 character word wrap
//15 + 15 + 2 + 2 +... + 15
If (iLength % (iRow + 1) + 2 (15 * * iRow)==0)
{
//limit twenty lines
If (iRow & gt;=19)
{
M_edit. EnableWindow (FALSE);
return;
}

StrText +="\ r \ n";
IRow++;
M_edit. SetWindowTextW (strText);
ILength=strText. GetLength ();
M_edit. SetSel (iLength iLength, FALSE);
M_edit. SetFocus ();
}
}
  • Related