delphi - 如何在Label和ListView中显示&

标签 delphi listview firemonkey delphi-xe

在 Delphi 10 Seattle 中使用 FireMonkey 编写多平台电话目录应用

数据存储在 XML 文件中。 屏幕有一个显示人员姓名的 ListView 和一个显示姓名、地址、电话号码等的详细信息选项卡。

当名字:Doe, John & Jane 显示它在两个组件中的处理方式不同。

The ListView shows:  Doe, John & Jane
The NameLabel shows: Doe, John Jane

如果我转义 XML 中的 &:Doe, John && Jane

The ListView shows:  Doe, John && Jane
The NameLabel shows: Doe, John & Jane

是否有可以设置的属性或可以附加到任一组件上的事件的代码?

最佳答案

默认情况下,& 用于标识标签控件的键盘加速键。要更改此默认行为,请设置 PrefixStyle属性为 TPrefixStyle.NoPrefix

Determines whether the ampersand character (&) is considered as a special prefix character.

The default value is TPrefixStyle.HidePrefix, which means that the (first) ampersand is hidden at run-time.

这是一个公共(public)属性,而不是已发布的属性,因此您需要在代码中进行设置。

关于delphi - 如何在Label和ListView中显示&,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33395715/

相关文章:

android - 在代码中设置listview项的透明度

delphi - 将图形复制到屏幕尺寸之外的 TMetaFileCanvas

delphi - 显示 TTreeViewItem 的 Expander 按钮

android - 带有 Json Api 的 ReactNative ListView

android - "Content has view with id attribute ' android.r.id.list ' that is not a ListView Class."在 fragment 中创建 ListView 时

delphi - 如何访问嵌套样式控件

performance - 为什么绘制小于 1.5 像素粗的线条比绘制 10 像素粗的线条慢两倍?

delphi - 自定义 Firemonkey 样式 - 在控件和样式之间链接属性?

sorting - Delphi 泛型 : TArray. 排序

delphi - 使用 Delphi 打开 ANSI 文件并保存 Unicode 文件