大网数据广告活动
安装更新与部署

FormatSize Control Attribute

· 52CE 我爱测

If this bit is set for a static text control, the control automatically attempts to format the displayed text as a number that represents a count of bytes.

If this bit is set for a static text control, the control automatically attempts to format the displayed text as a number that represents a count of bytes. For proper formatting, the control's text must be set to a string that represents a number expressed in units of 512 bytes. The displayed value is then formatted in kilobytes (KB), megabytes (MB), or gigabytes (GB), and displayed with the appropriate string that represents the units. For more information, see Text Control.

Numerical value of original text Unit string used
Less than 20480 KB
Less than 20971520 MB
Less than 10737418240 GB

Valid Controls

Decimal Hexadecimal Control
524288 0x00080000 msidbControlAttributesFormatSize

Remarks

To set this attribute on a control, include the FormatSize bits in the Attributes column of the control's record in the Control Table. The control's text must be set to a string representing a number expressed in units of 512 bytes. The text of the unit strings are defined in the UIText Table. The positioning of the unit string is controlled by the LeftUnit Property. If the LeftUnit Property is defined to be any value, the unit string appears before the numerical value. If anything other than numerical characters appears in the text associated with the control, the displayed value is undefined.

At run time, the installer resolves the PrimaryVolumeSpaceRequired Property to the total number of bytes required for the installation in units of 512. A static text control with FormatSize bit can be used to automatically format and label the total number of bytes required for the installation in KB, MB, or GB as appropriate. For the purposes of this example, assume the total number of bytes is 18,336,768. The installer sets the value of the PrimaryVolumeSpaceRequired property to 18,336,768 divided by 512, or 35,814. The number displayed by the text control with FormatSize would be 17MB.

The numerical values of the original text are given in units of 512. In the table above, the string 20,480 corresponds to the KB string because 20,480 times 512 yields a result of 10,485,760 bytes or 10,240 KB.

The unit strings listed in the previous table refer to keys in the UIText Table, where the text of the unit string is defined.

The positioning of the unit string is controlled by the LeftUnit Property. If the LeftUnit Property is defined to be any value, the unit string appears before the numerical value.

If anything other than numerical characters appears in the text associated with the control, the displayed value is undefined.

For more information, see Control Attributes and Controls.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。