冥界3大法王 发表于 2022-11-26 11:22

Delphi中RichView帮助中是这样写的。。。照抄从报错到还是没有效果


TCustomRichView.GetSelectionBoundsTop       Previous       Next

Returns bounds of selected part of document.procedure GetSelectionBounds(out StartItemNo, StartItemOffs,EndItemNo, EndItemOffs: Integer; Normalize: Boolean);ParametersStartItemNo – index of the first selected item.StartItemOffs:§if the first item is a text item, then the selection start is before the StartItemOffs-th character of string (characters in strings are counted from 1, the last position (after the text item) is text length+1). The exception is empty text items formatted with style having EmptyWidth>0; for them, the position after the item is 2.§if the first item is not a text, then §if StartItemOffs=0, then the selection start is before the first item;§if StartItemOffs=1, then the selection start is after the first item.EndItemNo – index of the last selected item.EndItemOffs:§if the last item is a text item, then the selection end is before the EndItemOffs-th character of string (characters in strings are counted from 1, the last position (after the text item) is text length+1). The exception is empty text items formatted with style having EmptyWidth>0; for them, the position after the item is 2.§if the last item is not a text, then §if EndItemOffs=0, then the selection end is before the last item§if EndItemOffs=1, then the selection end is after the last item.Normalize:§if True, the upper bound of the selection is returned in StartItemNo:StartItemOffs, and the lower bound is in EndItemNo:EndItemOffs;§if False, bounds are returned as they were selected by user. The selection is empty if§StartItemNo=-1 or§StartItemNo=EndItemNo and StartItemOffs=EndItemOffs. This method must be called only when the document is formatted. If you want to get selection bounds using richedit-like parameters (SelStart and SelLength), use RVGetSelection from RVLinear unit instead.See also methods:§SetSelectionBounds.See also:§Working with selection.
https://static.52pojie.cn/static/image/hrline/2.gif返回文档的部分边界{:301_971:}
procedure GetSelectionBounds(out StartItemNo, StartItemOffs,EndItemNo, EndItemOffs: Integer; Normalize: Boolean);
RichViewEdit1.GetSelectionBounds(2, 2 ,2 ,2, True);//我这么写没错吧?第1个参数,选定项的索引假设为2第2个参数,起始项目的偏移量也假设为2第3个参数,结束的索引也为2第4个参数,结束的偏移量也为2第5个参数布尔型,为True第1个参数它就报错啊。

我给它改成形参,它就不报下面的错误了。E2033 Types of actual and formal var parameters must be identical (Delphi)
procedure TForm5.Button4Click(Sender: TObject);

var

a1, a2, a3, a4: Integer;

begin

a1 := 1;

a2 := 1;

a3 := 1;

a4 := 1;

RichViewEdit1.GetSelectionBounds(a1, a2, a3, a4, True);

end;但是为啥没有效果呢?

psvajaz 发表于 2022-11-26 13:39

第三方比自带的好用,是否可以选择第三方的,你描述以下需要实现的功能,我给你推荐

as614001 发表于 2022-11-26 13:49

这个论坛看到Delphi 只有法王了

zxxiaopi 发表于 2022-11-26 15:13

难道只能自娱自乐?大佬呢?

lies2014 发表于 2022-11-26 17:36

out是输出的参数,只能给变量名,直接给一个数字肯定会出错了,E2033的错误应该就是这个原因
这个函数我没用过,单看它的定义,是不会有什么可见的动作的,返回的值(选择范围)都在a1、a2、a3、a4里了

冥界3大法王 发表于 2022-11-28 12:26

as614001 发表于 2022-11-26 13:49
这个论坛看到Delphi 只有法王了

@as614001
谁说的,天下知名软件有太多的太多都是Delphi开发的。。。随口说出几百个成名的软件来。
国外网友,台胞,还有好多QQ群里很多人用这个发财呢。你不用不代表没人用,并不代表它不闪光。

@lies2014
代码粘来发布后变形了,献眼了,见笑了。
{:301_976:}

as614001 发表于 2022-11-28 12:30

冥界3大法王 发表于 2022-11-28 12:26
@as614001
谁说的,天下知名软件有太多的太多都是Delphi开发的。。。随口说出几百个成名的软件来。
国 ...

和平与爱 不是看不起delphi 只是字面意思 这个论坛中delphi基本都是你而已。

as614001 发表于 2022-11-28 12:31

辉煌亦不代表拥有未来。
页: [1]
查看完整版本: Delphi中RichView帮助中是这样写的。。。照抄从报错到还是没有效果