📄 subject_51221.htm
字号:
<p>
序号:51221 发表者:圣诞小人 发表日期:2003-08-30 09:13:30
<br>主题:CEdit 的ModifyStyle 怎么没有用?
<br>内容:我为对话筐的一个编辑筐映射了一个CEdit型的Control变量,<BR>然后想通过按钮动态改变其Style(由普通到密码型),结果不行。<BR>关键代码如下:<BR>OnButton1()<BR>{<BR> m_edit.ModifyStyle(0,ES_PASSWORD);<BR> UpdateData(FALSE);<BR>}<BR><BR>难道ModifyStyle不是这么用吗?<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:木木二中 回复日期:2003-08-30 10:01:24
<br>内容:试试,我没试过不一定行。<BR>modifystyle(ES_PASSWORD,0);
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:微笑的撒旦 回复日期:2003-08-30 10:34:17
<br>内容:Edit Control Styles<BR><BR>--------------------------------------------------------------------------------<BR><BR>To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted. <BR><BR>Constants<BR><BR>ES_AUTOHSCROLL <BR>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 zero.<BR><BR>ES_AUTOVSCROLL <BR>Automatically scrolls text up one page when the user presses the ENTER key on the last line.<BR><BR>ES_CENTER <BR>Windows 98/Me, Windows 2000/XP: Centers text in a single-line or multiline edit control.<BR>Windows 95, Windows NT 4.0 and earlier: Centers text in a multiline edit control.<BR><BR><BR>ES_LEFT <BR>Left aligns text.<BR><BR>ES_LOWERCASE <BR>Converts all characters to lowercase as they are typed into the edit control.<BR>To change this style after the control has been created, use SetWindowLong.<BR><BR><BR>ES_MULTILINE <BR>Designates a multiline edit control. The default is single-line edit control. <BR>When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style.<BR><BR>When the multiline edit control is not in a dialog box and 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 you do not specify ES_AUTOVSCROLL, the edit control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed.<BR><BR>If you specify the ES_AUTOHSCROLL style, the multiline 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 the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping position changes and the text is redisplayed.<BR><BR>Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the parent window.<BR><BR><BR>ES_NOHIDESEL <BR>Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, even if the control does not have the focus.<BR><BR>ES_NUMBER <BR>Allows only digits to be entered into the edit control. Note that, even with this set, it is still possible to paste non-digits into the edit control.<BR>To change this style after the control has been created, use SetWindowLong.<BR><BR><BR>ES_OEMCONVERT <BR>Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain file names. <BR>To change this style after the control has been created, use SetWindowLong. <BR><BR><BR>ES_PASSWORD <BR>Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls. <BR>Windows XP: If the edit control is from user32.dll, the default password character is an asterisk. However, if the edit control is from comctl32.dll version 6, the default character is a black circle. <BR><BR>To change the characters that is displayed, or set or clear this style, use the EM_SETPASSWORDCHAR message. <BR><BR>Note Comctl32.dll version 6 is not redistributable but it is included in Microsoft? Windows? XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Using Windows XP Visual Styles.<BR><BR>ES_READONLY <BR>Prevents the user from typing or editing text in the edit control.<BR>To change this style after the control has been created, use the EM_SETREADONLY message. <BR><BR><BR>ES_RIGHT <BR>Windows 98/Me, Windows 2000/XP: Right aligns text in a single-line or multiline edit control. Windows 95, Windows NT 4.0 and earlier: Right aligns text in a multiline edit control.<BR><BR>ES_UPPERCASE <BR>Converts all characters to uppercase as they are typed into the edit control. <BR>To change this style after the control has been created, use SetWindowLong.<BR><BR><BR>ES_WANTRETURN <BR>Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control. <BR>To change this style after the control has been created, use SetWindowLong.<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:圣诞小人 回复日期:2003-08-30 16:11:42
<br>内容:原来如此!<BR>Thanks!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -