4
我需要轉換WPF「字體」中的GDI字體。將System.Drawing.Font.Size轉換爲WPF FontSize
myGdiFont As System.Drawing.Font
在
_Family As Windows.Media.FontFamily
_Style As Windows.FontStyle
_Weight As Windows.FontWeight
_Size As Double
在particularry,我需要轉換
_Size = myGdiFont.Size (???)
中的WinForms大小的字體是單位或點數...在WPF是在像素...如何從一個轉換到另一個?
PS。
Follwing Clemens指示,這是正確的嗎?
Dim myDrawingFont As New System.Drawing.Font("Arial", 10)
Dim myWpfLabel As New Windows.Controls.Label
myWpfLabel.FontSize = myDrawingFont.SizeInPoints * 72/96
修正:
myWpfLabel.FontSize = myDrawingFont.SizeInPoints * 96/72
你能檢查我的編輯是否正確嗎? – serhio 2012-03-14 13:15:18
不,它應該是'myWpfLabel.FontSize = myDrawingFont.SizeInPoints/72 * 96'。 – Clemens 2012-03-14 13:22:07