gpt4 book ai didi

c# - 创建 Thickness() 时如何使用合格的 Double?

转载 作者:太空宇宙 更新时间:2023-11-03 19:10:18 25 4
gpt4 key购买 nike

我需要创建一个 6 厘米的厚度,我无法以厘米为单位设置尺寸,我正在查看 msdn但我不知道如何使用 qualifiedDouble

string qualifiedDouble = "6cm";
flowDoc.ColumnWidth = Convert.ToDouble(new Thickness(qualifiedDouble));

我在这里做错了什么?谢谢

最佳答案

使用 LengthConverter :

LengthConverter lc = new LengthConverter();
string qualifiedDouble = "6cm";

double converted = (double)lc.ConvertFrom(qualifiedDouble);
flowDoc.ColumnWidth = converted;

关于c# - 创建 Thickness() 时如何使用合格的 Double?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21231168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com