我需要创建6cm的厚度,我无法以厘米为单位设置尺寸,我在查看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;

10-08 14:50