VB转化为C#
那位高手帮我把下面的VB代码转化为C#Attribute VB_Name = "Module1"
Private Declare Sub Sleep Lib "kernel32" (ByVal dwseconds As Long)
Public Function s7200_M1_set(MSComm1 As Object, Mx As Byte, My As Byte, Mv As Byte)
Dim str_write(0 To 37) As Byte
Dim str_val(0 To 5) As Byte
Dim Temp_FCS As Variant
Dim i As Long
str_write(0) = &H68
str_write(1) = &H20
str_write(2) = &H20
str_write(3) = &H68
str_write(4) = &H2
str_write(5) = &H0
str_write(6) = &H7C
str_write(7) = &H32
str_write(8) = &H1
str_write(9) = &H0
str_write(10) = &H0
str_write(11) = &H43
str_write(12) = &H1
str_write(13) = &H0
str_write(14) = &HE
str_write(15) = &H0
str_write(16) = &H5
str_write(17) = &H5
str_write(18) = &H1
str_write(19) = &H12
str_write(20) = &HA
str_write(21) = &H10
str_write(22) = &H1
str_write(23) = &H0
str_write(24) = &H1
str_write(25) = &H0
str_write(26) = &H0
str_write(27) = &H83
str_write(28) = &H0
str_write(29) = &H0
str_write(30) = Mx * 8 + My
str_write(31) = &H0
str_write(32) = &H3
str_write(33) = &H0
str_write(34) = &H1
str_write(35) = Mv
For i = 4 To 35 '计算数据和
Temp_FCS = Temp_FCS + str_write(i)
Next
str_write(36) = Temp_FCS Mod 256 '计算检验码
str_write(37) = &H16
MSComm1.Output = str_write
Sleep (100)
str_val(0) = &H10
str_val(1) = &H2
str_val(2) = &H0
str_val(3) = &H5C
str_val(4) = &H5E
str_val(5) = &H16
MSComm1.Output = str_val
End Function
Public Function s7200_M2_set(MSComm1 As Object, Mx As Byte, My As Byte, Mv As Byte)
Dim str_write(0 To 37) As Byte
Dim str_val(0 To 5) As Byte
Dim Temp_FCS As Variant
Dim i As Long
str_write(0) = &H68
str_write(1) = &H20
str_write(2) = &H20
str_write(3) = &H68
str_write(4) = &H2
str_write(5) = &H0
str_write(6) = &H7C
str_write(7) = &H32
str_write(8) = &H1
str_write(9) = &H0
str_write(10) = &H0
str_write(11) = &H43
str_write(12) = &H1
str_write(13) = &H0
str_write(14) = &HE
str_write(15) = &H0
str_write(16) = &H5
str_write(17) = &H5
str_write(18) = &H1
str_write(19) = &H12
str_write(20) = &HA
str_write(21) = &H10
str_write(22) = &H1
str_write(23) = &H0
str_write(24) = &H1
str_write(25) = &H0
str_write(26) = &H0
str_write(27) = &H83
str_write(28) = &H0
str_write(29) = &H0
str_write(30) = Mx * 8 + My
str_write(31) = &H0
str_write(32) = &H3
str_write(33) = &H0
str_write(34) = &H1
str_write(35) = Mv
For i = 4 To 35 '计算数据和
Temp_FCS = Temp_FCS + str_write(i)
Next
str_write(36) = Temp_FCS Mod 256 '计算检验码
str_write(37) = &H16
MSComm1.Output = str_write
Sleep (100)
str_val(0) = &H10
str_val(1) = &H2
str_val(2) = &H0
str_val(3) = &H5C
str_val(4) = &H5E
str_val(5) = &H16
MSComm1.Output = str_val
End Function
--------------------编程问答-------------------- 太长了,找个转换工具吧 --------------------编程问答-------------------- 有什么转换工具??
补充:.NET技术 , C#