精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>WINDOWS界面设计>>编辑框问题

主题:编辑框问题
发信人: gzlujiang()
整理人: skyice(1999-11-13 15:05:04), 站内信件
【 在 skyice (skyline) 的大作中提到: 】
: 在程序运行期间如何使一个编辑框只读,不是disable?

向编辑框发送EM_SETREADONLY消息,其在WIN32API中定义如下:

An application sends an EM_SETREADONLY message to set or remove the re
ad-only style (ES_READONLY) of an edit control. 

EM_SETREADONLY  
wParam = (WPARAM) (BOOL) fReadOnly;  // read-only flag 
lParam = 0;                          // not used; must be zero 
 

Parameters

fReadOnly

Value of wParam. Specifies whether to set or remove the ES_READONLY st
yle. A value of TRUE sets the ES_READONLY style; a value of FALSE remo
ves the ES_READONLY style. 

 

Return Values

If the operation succeeds, the return value is nonzero; otherwise, it 
is zero. 

Remarks

When an edit control has the ES_READONLY style, the user cannot change
 the text within the edit control. 
To determine whether an edit control has the ES_READONLY style, use th
e GetWindowLong function with the GWL_STYLE flag. 

--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.190.124]

[关闭][返回]