WPF Specify controls' length in millimeters

可紊 提交于 2020-12-26 08:33:16

问题


These days I am working on a complex WPF application. So far it has been a good experience. But I am stuck on a point. Its a designer application and users drag custom controls on a canvas and set their properties. Currently users can specify the control's length in cm, in, px and pt. I need to give them the option of specifying control's length in millimeters.

I know of LengthConverter class in WPF but it does not give us the facility to use millimeters as unit. Why is that? Why would Microsoft not give the possibility of specifying lengths of controls in mm?

What are the workarounds to do so?


回答1:


Wondering if this question was left unanswered because of the obvious answer...

If you can use cm as a size there is no problem.

Ask for the desired size in mm, divide by ten and you're there.

Why would Microsoft not give the possibility of specifying lengths of controls in mm?

Maybe because they don't feel it's necessary to add support for all multiples of 10? You might as well ask why they don't use micrometers, millimetres, decimetres, meters, decameters, hectometres, kilometres... because the conversion from cm is so easy.

To wit, they do use inch and pt even though there's an easy conversion factor of 72. But that 's not as obvious.



来源:https://stackoverflow.com/questions/13272669/wpf-specify-controls-length-in-millimeters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!