c转为vb.net,c转为和弦

如何把下面的C#代码转换为VB.NET或者加个注解,新手看不明白?

Dim obj = file15.GetThumbnail2(version)

目前创新互联已为近1000家的企业提供了网站建设、域名、网络空间、网站托管、服务器租用、企业网站设计、耀州网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

Dim imgPreview As System.Drawing.Image = PictureDispConverter.Convert(obj)

imgPreview.Save("C:\temp\123456.bmp", System.Drawing.Imaging.ImageFormat.Bmp)

imgPreview.Dispose()

Public Class PictureDispConverter

Inherits AxHost

Public Sub New()

MyBase.New("56174C86-1546-4778-8EE6-B6AC606875E7")

End Sub

Public Shared Function Convert(ByVal objIDispImage As Object) As System.Drawing.Image

Dim objPicture As System.Drawing.Image = Nothing

objPicture = CType(System.Windows.Forms.AxHost.GetPictureFromIPicture(objIDispImage), System.Drawing.Image)

Return objPicture

End Function

End Class

请帮忙将以下C语言代码转换为VB.NET代码,谢谢!

Option Explicit On

Option Strict On

Imports System

Module Program

Sub Main()

Dim y,m,t As Integer

begin:

' 输入数据时一行一个

y=CInt(Console.ReadLine())

m=CInt(Console.ReadLine())

t=CInt(Console.ReadLine())

If y100 Then

y=y+2000

End If

If y1916 OrElse m200 Then

Console.WriteLine("ERROR")

goto begin

End If

pr(y,m,t)

Console.Write("Press any key to continue . . . ")

Console.ReadKey(True)

End Sub

Function pr(y As Integer,m As Integer,t As Integer) As Integer

Dim ye,[Me],i As Integer

ye=CInt((m+t-2)/12+y)

[Me]=(m+t-2) Mod 12+1

Console.WriteLine(" {0}-{1} ~ {2}-{3}",y,m,ye,[Me])

ye=y

[Me]=m

For i=0 To t-1

prmonth(ye,[me])

[Me]=[Me]+1

If [Me]12 Then

ye=ye+1

[me]=1

End If

Next

Return 0

End Function

Function yam(y As Integer,m As Integer) As Integer

Dim st As String()={"未定义","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}

Console.WriteLine(" {0} {1}",y,st(m))

Console.WriteLine("----------------------------")

Return 0

End Function

Function ryear(y As Integer) As Integer

If 0=y Mod 400 OrElse (0y Mod 100 AndAlso 0=y Mod 4) Then

Return 1

Else

Return 0

End If

End Function

Function mday(y As Integer,m As Integer) As Integer

Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}

Dim ad As Integer=0

If 2=m Then

ad=ryear(y)

End If

Return day(m)+ad

End Function

Function monday(y As Integer,m As Integer) As Integer

Dim md As Integer=6

Dim i,daynum As Integer

For i=1916 To y-1

daynum=365+ryear(i)

md=(md+daynum) Mod 7

Next

For i=1 To m-1

md=(md+mday(y,i)) Mod 7

Next

Return md

End Function

Function prmonth(y As Integer,m As Integer) As Integer

Dim md As Integer=monday(y,m)

Dim daysnum As Integer=mday(y,m)

Dim days As Integer=daysnum+md

Dim i As Integer

yam(y,m)

Console.Write(" 日 一 二 三 四 五 六")

For i=0 To days-1

If 0=i Mod 7 Then

Console.WriteLine()

Console.WriteLine()

Console.Write(" ")

End If

If i-md=0 Then

Console.Write(" {0,2}",i-md+1)

Else

Console.Write(" ")

End If

Next

Console.WriteLine()

Console.WriteLine()

Return 0

End Function

End Module

C#代码转换成VB.net,事件注册处理方法

'api.OnFrontConnected += new FrontConnected(OnFrontConnected);

AddHandler api.OnFrontConnected, AddressOf OnFrontConnected

C语言转换为VB.NET

Option Explicit On

Option Strict On

Imports System

Module Program

Sub Main()

Dim y,m,t As Integer

begin:

' 输入数据时一行一个

y=CInt(Console.ReadLine())

m=CInt(Console.ReadLine())

t=CInt(Console.ReadLine())

If y

200 Then

Console.WriteLine("ERROR")

goto begin

End If

pr(y,m,t)

Console.Write("Press any key to continue . . . ")

Console.ReadKey(True)

End Sub

Function pr(y As Integer,m As Integer,t As Integer) As Integer

Dim ye,[Me],i As Integer

ye=CInt((m+t-2)/12+y)

[Me]=(m+t-2) Mod 12+1

End If

End Function

Function mday(y As Integer,m As Integer) As Integer

Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}

Dim ad As I

C#代码转VB.Net代码

Private Sub wmp_PlayStateChange(sender As Object, e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent)

If DirectCast(e.newState, WMPLib.WMPPlayState) = WMPLib.WMPPlayState.wmppsReady Then

wmp.Ctlcontrols.play()

End If

End Sub

Private Sub axWindowsMediaPlayer1_PlayStateChange(sender As Object, e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent)

If axWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsMediaEnded Then

Me.axWindowsMediaPlayer1.currentPlaylist.clear()

Me.axWindowsMediaPlayer1.currentPlaylist.appendItem(Me.axWindowsMediaPlayer1.newMedia("f:\b.wmv"))

axWindowsMediaPlayer1.settings.setMode("loop", True)

timer1.Enabled = True

End If

End Sub

Private Sub timer1_Tick(sender As Object, e As EventArgs)

timer1.Enabled = False

axWindowsMediaPlayer1.Ctlcontrols.play()

End Sub

当前标题:c转为vb.net,c转为和弦
文章链接:https://www.cdcxhl.com/article32/dsehppc.html

成都网站建设公司_创新互联,为您提供网站建设关键词优化移动网站建设虚拟主机Google

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站托管运营