原创(作品):
Dim fnt As Drawing.Font = New Drawing.Font( _
rtf.SelectionFont.FontFamily, _
rtf.SelectionFont.Size, _
DirectCast(rtf.SelectionFont.Style _
+ If(rtf.SelectionFont.Underline, _
-Drawing.FontStyle.Underline, _
Drawing.FontStyle.Underline), _
Drawing.FontStyle) _
)
翻译 () 不能将 FontStyle 转换为 int:
System.Drawing.Font fnt = new System.Drawing.Font(
rtf_Renamed.SelectionFont.FontFamily,
rtf_Renamed.SelectionFont.Size,
(System.Drawing.FontStyle)(
rtf_Renamed.SelectionFont.Style
+ rtf_Renamed.SelectionFont.Underline
? -System.Drawing.FontStyle.Underline //cannot cast to int
: System.Drawing.FontStyle.Underline
)
);
那么如何将这些 .NET 属性转换为它们的数值呢?