关于Delphi的TMemo控件
最近在看delphi的VCL源码时,发现TMemo的Text属性不知是哪继承来的,往上只追到TCustomEdit里public属性的Text,但却没有读写方法TCust...
最近在看delphi的VCL源码时,发现TMemo的Text属性不知是哪继承来的,往上只追到
TCustomEdit里public属性的Text,但却没有读写方法
TCustomEdit = class(TWinControl)
public
...
property Text;
end;
再往上是TWinControl根本就没有Text这个属性,所以比较困惑的是,当我们给Memo的Text赋值时它是怎么传递的,一般的property(属性)都有读写方法一看就知道内部是怎么变的,这个TMemo的Text有什么特殊,望高手指点,哪位说明白了,加分 展开
TCustomEdit里public属性的Text,但却没有读写方法
TCustomEdit = class(TWinControl)
public
...
property Text;
end;
再往上是TWinControl根本就没有Text这个属性,所以比较困惑的是,当我们给Memo的Text赋值时它是怎么传递的,一般的property(属性)都有读写方法一看就知道内部是怎么变的,这个TMemo的Text有什么特殊,望高手指点,哪位说明白了,加分 展开
3个回答
2011-05-18
展开全部
TMemo归属stdrctrls单元 类关系为TObject-TPeresistent-TCompontent-TContol-TWinControl-TCustomEdit-TCustomMemo;可以利用Ctrl+类名跟踪一下,可以看到memo的text是继承了上层TCustomEdit中的Text属性可以继续向上追踪。
TCustomEdit的属性列表如下:
StdCtrls.TCustomEdit PropertiesFrom RAD Studio VCL Referencer
Up to Parent: TCustomEdit
Alignment Determines how the text is aligned within the text edit control.
AutoSelect Determines whether all the text in the edit control is automatically selected when the control gets focus.
AutoSize Determines whether the height of the edit control automatically resizes to accommodate the text.
BorderStyle Determines whether the edit control has a single line border around the client area.
CanUndo Indicates whether the edit control contains changes that can be backed out.
CharCase Determines the case of the text within the edit control.
HideSelection Determines whether the visual indication of the selected text remains when focus shifts to another control.
MaxLength Specifies the maximum number of characters the user can enter into the edit control.
Modified Indicates whether the user edited the text of the edit control.
NumbersOnly Allows only numbers to be typed into the text edit.
OEMConvert Determines whether characters typed in the edit control are converted from ANSI to OEM and then back to ANSI.
ParentColor
PasswordChar Indicates the character, if any, to display in place of the actual characters typed in the control.
ReadOnly Determines whether the user can change the text of the edit control.
SelLength Specifies the number of characters (bytes) that are selected.
SelStart Specifies the position of the first selected character in the text.
SelText Specifies the selected portion of the edit control's text.
TabStop
Text
TextHint A hint or message to be displayed when the Text property is empty.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
text在delphi中的描述为:
StdCtrls.TCustomEdit.Text inherits from Controls.TControl.Text. All content below this line refers to Controls.TControl.Text.
Contains a text string associated with the control.
Use the Text property to read the Text of the control or to specify a new string for the Text value. By default, Text is the control name. For edit controls and memos, the Text appears within the control. For combo boxes, the Text is the content of the edit control portion of the combo box.
Note: Controls that display text use either the Caption property or the Text property to specify the text value. Which property is used depends on the type of control. In general, Caption is used for text that appears as a window title or label, while Text is used for text that appears as the content of a control.
TCustomEdit的属性列表如下:
StdCtrls.TCustomEdit PropertiesFrom RAD Studio VCL Referencer
Up to Parent: TCustomEdit
Alignment Determines how the text is aligned within the text edit control.
AutoSelect Determines whether all the text in the edit control is automatically selected when the control gets focus.
AutoSize Determines whether the height of the edit control automatically resizes to accommodate the text.
BorderStyle Determines whether the edit control has a single line border around the client area.
CanUndo Indicates whether the edit control contains changes that can be backed out.
CharCase Determines the case of the text within the edit control.
HideSelection Determines whether the visual indication of the selected text remains when focus shifts to another control.
MaxLength Specifies the maximum number of characters the user can enter into the edit control.
Modified Indicates whether the user edited the text of the edit control.
NumbersOnly Allows only numbers to be typed into the text edit.
OEMConvert Determines whether characters typed in the edit control are converted from ANSI to OEM and then back to ANSI.
ParentColor
PasswordChar Indicates the character, if any, to display in place of the actual characters typed in the control.
ReadOnly Determines whether the user can change the text of the edit control.
SelLength Specifies the number of characters (bytes) that are selected.
SelStart Specifies the position of the first selected character in the text.
SelText Specifies the selected portion of the edit control's text.
TabStop
Text
TextHint A hint or message to be displayed when the Text property is empty.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
text在delphi中的描述为:
StdCtrls.TCustomEdit.Text inherits from Controls.TControl.Text. All content below this line refers to Controls.TControl.Text.
Contains a text string associated with the control.
Use the Text property to read the Text of the control or to specify a new string for the Text value. By default, Text is the control name. For edit controls and memos, the Text appears within the control. For combo boxes, the Text is the content of the edit control portion of the combo box.
Note: Controls that display text use either the Caption property or the Text property to specify the text value. Which property is used depends on the type of control. In general, Caption is used for text that appears as a window title or label, while Text is used for text that appears as the content of a control.
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
展开全部
在TControl这个类里面,修饰为
protected
property Text: TCaption read GetText write SetText;
在TWinControl类里面写
public
property Text;
使用public修饰更改text属性, 使该属性可被访问。
实际访问的就是Tcoltrol的Text属性
protected
property Text: TCaption read GetText write SetText;
在TWinControl类里面写
public
property Text;
使用public修饰更改text属性, 使该属性可被访问。
实际访问的就是Tcoltrol的Text属性
追问
再请问下,TControl里的Text读写方法都是在私用域,怎么取TMemo的Text属性的读写地址呢(PS:有个软件是Delphi编的,我要取TMemo的内容,已经可以成功注入,但TMemo的TEXT内存地址一直找不到,想从TMemo的具体实现上找方法)
另外我用的是D7,TWinControl里并没有property Text; 是不是版本问题,还是这个属性可以跨级继承TControl里的protected域里的Text属性
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
直接从TControl继承而来。在CustomEdit中只是改变成公用属性而已。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询