如何设置一个字符串中的DataGridViewCell的方向?字符串、如何设置、方向、DataGridViewCell

2023-09-06 14:25:29 作者:一抹旧時光、涼透半盏流年

我如何在一个的DataGridViewColumn设定从右至左属性特定的DataGridViewCell?

How do I set the RightToLeft property for a particular DataGridViewCell in a DataGridViewColumn?

推荐答案

这样的属性不存在。您需要设置 从右至左属性的整个控制 的。

Such a property does not exist. You need to set the RightToLeft property of the entire control.

我怀疑你试图误用的财产,以右对齐文本。它的目的是使为使用从右向左的字体,而不是自定义格式的语言环境支持。

I suspect that you're attempting to mis-use the property to right-justify your text. It's intended to enable support for locales that use right-to-left fonts, not for custom formatting.

如果改变格式化你的目标,每个的DataGridViewCell 拥有的 风格属性一个接受的 的DataGridViewCellStyle 类。您可以设置它的 对齐属性以MiddleRight对齐单元格的内容垂直的中间水平在正确的。欲了解更多信息,请参阅:如何在Windows的格式化数据窗体DataGridView控件

If altering formatting is your goal, each DataGridViewCell has a Style property that accepts an instance of the DataGridViewCellStyle class. You can set its Alignment property to "MiddleRight" to align the content of the cell vertically at the middle and horizontally at the right. For more information, see: How to: Format Data in the Windows Forms DataGridView Control.