我不想要横向的滚动条 但要纵向的滚动条如果过长要自动换行 在原来文本换行的地方要显示换行 (现在的Editview是手工从Cview改过来的) who help me
ASCII "0xd","0x10"为回车,换行
CDocument::OpenDocumentFile(...);
在Create()时使用适当的ES_STYLE,因为你是从CView修改来的,估计没有修改这个Edit的style,至少有ES_MULTILINE.具体参考以下(From MSDN): Edit Styles ES_AUTOHSCROLL Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position 0. ES_AUTOVSCROLL Automatically scrolls text up one page when the user presses ENTER on the last line. ES_CENTER Centers text in a single-line or multiline edit control. ES_LEFT Left-aligns text in a single-line or multiline edit control. ES_LOWERCASE Converts all characters to lowercase as they are typed into the edit control. ES_MULTILINE Designates a multiple-line edit control. (The default is single line.) If the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If ES_AUTOVSCROLL is not given, the edit control shows as many lines as possible and beeps if ENTER is pressed when no more lines can be displayed. If the ES_AUTOHSCROLL style is specified, the multiple-line edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press ENTER. If ES_AUTOHSCROLL is not given, the control automatically wraps words to the beginning of the next line when necessary; a new line is also started if ENTER is pressed. The position of the wordwrap is determined by the window size. If the window size changes, the wordwrap position changes and the text is redisplayed. Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above and process any scroll messages sent by the parent window. ES_NOHIDESEL Normally, an edit control hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. Specifying ES_NOHIDESEL deletes this default action. ES_OEMCONVERT Text entered in the edit control is converted from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the AnsiToOem Windows function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames. ES_PASSWORD Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the SetPasswordChar member function to change the character that is displayed. ES_RIGHT Right-aligns text in a single-line or multiline edit control. ES_UPPERCASE Converts all characters to uppercase as they are typed into the edit control. ES_READONLY Prevents the user from entering or editing text in the edit control. ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiple-line edit control in a dialog box. Without this style, pressing the ENTER key has the same effect as pressing the dialog box’s default pushbutton. This style has no effect on a single-line edit control.
我从msdn上看到了,但改了一些还是不行,要么我再去try try 谢谢大家给我的帮助:)
用OnOpenDocument()出现问题,发生打开文件共享违例 what's the matter B.T.W用onopendocument()打开文件后,这个文件会自动显示在view里?
而且不用系统给的ID_File_OPEN打开文件
而是自己做个菜单项,按了以后直接把一个TXT文件显示在editview里
who tell me我该怎么做,最好具体点,先谢谢了
我要用自己的菜单项打开并显示文件(显示在editview里)
而且要有几个相同功能的菜单项
CStdioFile file("your text file",CFile::modeRead | CFile::typeText);
while(file.ReadString(strLine))
strAll+=strLine;
CEdit &editCtrl=editView.GetEditCtrl();
editCtrl.SetWindowText(strAll);
file.close()
加分加分hehe还有就是好象你的代码有点问题我把
CEdit &editCtrl=editView.GetEditCtrl();
editCtrl.SetWindowText(strAll);
改成
this->SetWindowText(strAll);才可以
使用ModifyStyle()
editCtrl.ModifyStyle(ES_AUTOHSCROLL,0,SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER); //自动换行
...
把 ES_AUTOHSCROLL 和 0 交换一下位置,不自动换行。
他会出现横向的滚动条,显示成一行
而且原来文本换行的地方也没有换行help~~~~!
但要纵向的滚动条如果过长要自动换行
在原来文本换行的地方要显示换行
(现在的Editview是手工从Cview改过来的)
who help me
Edit Styles
ES_AUTOHSCROLL Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position 0.
ES_AUTOVSCROLL Automatically scrolls text up one page when the user presses ENTER on the last line.
ES_CENTER Centers text in a single-line or multiline edit control.
ES_LEFT Left-aligns text in a single-line or multiline edit control.
ES_LOWERCASE Converts all characters to lowercase as they are typed into the edit control.
ES_MULTILINE Designates a multiple-line edit control. (The default is single line.) If the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If ES_AUTOVSCROLL is not given, the edit control shows as many lines as possible and beeps if ENTER is pressed when no more lines can be displayed. If the ES_AUTOHSCROLL style is specified, the multiple-line edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press ENTER. If ES_AUTOHSCROLL is not given, the control automatically wraps words to the beginning of the next line when necessary; a new line is also started if ENTER is pressed. The position of the wordwrap is determined by the window size. If the window size changes, the wordwrap position changes and the text is redisplayed. Multiple-line edit controls can have scroll bars. An edit control with scroll bars processes its own scroll-bar messages. Edit controls without scroll bars scroll as described above and process any scroll messages sent by the parent window.
ES_NOHIDESEL Normally, an edit control hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. Specifying ES_NOHIDESEL deletes this default action.
ES_OEMCONVERT Text entered in the edit control is converted from the ANSI character set to the OEM character set and then back to ANSI. This ensures proper character conversion when the application calls the AnsiToOem Windows function to convert an ANSI string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames.
ES_PASSWORD Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the SetPasswordChar member function to change the character that is displayed.
ES_RIGHT Right-aligns text in a single-line or multiline edit control.
ES_UPPERCASE Converts all characters to uppercase as they are typed into the edit control.
ES_READONLY Prevents the user from entering or editing text in the edit control.
ES_WANTRETURN Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiple-line edit control in a dialog box. Without this style, pressing the ENTER key has the same effect as pressing the dialog box’s default pushbutton. This style has no effect on a single-line edit control.
谢谢大家给我的帮助:)
what's the matter
B.T.W用onopendocument()打开文件后,这个文件会自动显示在view里?
onopendocument()打开文件后,这个文件会自动显示在view里?
好象改了没有用啊:(