一个简单问题

ppzhao 2001-07-21 01:23:05
TCustomEdit::AutoSize
Determines whether the height of the edit control automatically resizes to accommodate the text.

__property bool AutoSize = {read=FAutoSize, write=SetAutoSize, default=1};

Description

Use AutoSize to make the edit control adjust its size automatically so the client area accommodates the height of the text. When AutoSize is false, the edit control has a fixed height. When AutoSize is true, the size of the control is readjusted whenever a change occurs that could affect the height of the control, such as a change to the font or border style.

Note: AutoSize only adjusts the height of the edit control. Even with AutoSize set to true, text in the edit control may appear truncated if it extends beyond the width of the control.

能不能解释一下{read=FAutoSize, write=SetAutoSize, default=1}这是什么意思?
谢谢!
...全文
86 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ppzhao 2001-07-21
  • 打赏
  • 举报
回复
明白了,谢谢!
aningstar 2001-07-21
  • 打赏
  • 举报
回复
举个例子
class myclass
{private:
int FCount;
void SetCount(int value);
property:int Count={read=FCout,write=SetCout,default=10};

}
这样,属性栏里就有Count这个属性,默认值为10

一般,SetCout(int value)只是 FCount=value,现在你应该明白了,这样一包装,
别人不能直接操纵Count,不就安全了许多?
aningstar 2001-07-21
  • 打赏
  • 举报
回复
这是TCustomEdit的一个属性,由FAutoSize来读(一个bool变量),由SetAutoSize()来设置,默认为1,也就是true
一般,FAutoSize和SetAutoSize() 都放在privite中,这样,就有效的封装了属性AutoSize,达到了安全的目的。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧