C# 与VBNET中的(IntPtr)1等效?
我从@Hans Passant代码中提取了一段代码: 这是C代码: 哪一个将被翻译成vb.net 这将不起作用(无法编译): 试试这个:C# 与VBNET中的(IntPtr)1等效?,c#,.net,vb.net,intptr,code-translation,C#,.net,Vb.net,Intptr,Code Translation,我从@Hans Passant代码中提取了一段代码: 这是C代码: 哪一个将被翻译成vb.net 这将不起作用(无法编译): 试试这个: SendMessage(hText, WM_SETFONT, mFont.ToHfont(), New IntPtr(1)) 编译错误是什么?无法将整数强制转换为系统。IntPtr@DouglasBarbin是的,这是编译错误,谢谢你这么说。DirectCast不是C#cast运算符的通用转换。类型和要强制转换的项之间的关系必须是继承关系或实现关系。 Sen
SendMessage(hText, WM_SETFONT, mFont.ToHfont(), New IntPtr(1))
编译错误是什么?无法将整数强制转换为系统。IntPtr@DouglasBarbin是的,这是编译错误,谢谢你这么说。DirectCast不是C#cast运算符的通用转换。类型和要强制转换的项之间的关系必须是继承关系或实现关系。
SendMessage(hText, WM_SETFONT, mFont.ToHfont(), DirectCast(1, IntPtr))
SendMessage(hText, WM_SETFONT, mFont.ToHfont(), New IntPtr(1))