如何将以下vb代码转换为c# [英] how to convert following vb code into c#
本文介绍了如何将以下vb代码转换为c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
私有 Sub Command1_Click()
Dim MyWord As Word。应用程序,WordDoc As Word.Document
设置 MyWord = 新 Word.Application
设置 WordDoc = MyWord.Documents.Add
AddWaterMark WordDoc
MyWord.Visible = True
结束 Sub
私有 Sub AddWaterMark(pDoc As Word.Document)
pDoc.Shapes.AddTextEffect 0 , ULTRA S. ECRET, Century Gothic, 1 , False , False , 0 , 0
pDoc.Shapes( 1 )。Name = PowerPlusWaterMarkObject1
pDoc.Shapes( 1 ).TextEffect.NormalizedHeight = False
pDoc.Shapes( 1 )。Line.Visible = False
pDoc.Shapes( 1 )。Fill.Visible = True
pDoc.Shapes( 1 )。Fill.Solid
pDoc.Shapes( 1 )。Fill.ForeColor.RGB = RGB( 0 , 255 , 255 )
pDoc.Shapes( 1 )。Fill.Transparency = 0 。 8
pDoc.Shapes( 1 )。旋转= 315
pDoc.Shapes( 1 )。LockAspectRatio = True
pDoc.Shapes( 1 )。高度= 80
pDoc.Shapes( 1 )。宽度= 520
pDoc.Shapes( 1 )。WrapFormat.AllowOverlap = True
pDoc.Shapes ( 1 )。WrapFormat.Side = wdWrapNone
pDoc.Shapes( 1 )。WrapFormat。 Type = 3
pDoc.Shapes( 1 )。RelativeHorizontalPositi on = wdRelativeVerticalPositionMargin
pDoc.Shapes( 1 )。RelativeVerticalPosition = wdRelativeVerticalPositionMargin
pDoc.Shapes( 1 )。左= wdShapeCenter
pDoc.Shapes( 1 )。顶部= wdShapeCenter
结束 Sub
解决方案
这里是链接http ://codeconverter.sharpdevelop.net/SnippetConverter.aspx
试试这段代码(不是翻译):[ ^ ]。
任何努力?如果您 Google [ ^ ],已经有很多在线转换器可供使用。
多年来这个对我来说很好用:
http://www.developerfusion.com/tools/convert/ vb-to-csharp / [ ^ ]
Private Sub Command1_Click()
Dim MyWord As Word.Application, WordDoc As Word.Document
Set MyWord = New Word.Application
Set WordDoc = MyWord.Documents.Add
AddWaterMark WordDoc
MyWord.Visible = True
End Sub
Private Sub AddWaterMark(pDoc As Word.Document)
pDoc.Shapes.AddTextEffect 0, "ULTRA SECRET", "Century Gothic", 1, False, False, 0, 0
pDoc.Shapes(1).Name = "PowerPlusWaterMarkObject1"
pDoc.Shapes(1).TextEffect.NormalizedHeight = False
pDoc.Shapes(1).Line.Visible = False
pDoc.Shapes(1).Fill.Visible = True
pDoc.Shapes(1).Fill.Solid
pDoc.Shapes(1).Fill.ForeColor.RGB = RGB(0, 255, 255)
pDoc.Shapes(1).Fill.Transparency = 0.8
pDoc.Shapes(1).Rotation = 315
pDoc.Shapes(1).LockAspectRatio = True
pDoc.Shapes(1).Height = 80
pDoc.Shapes(1).Width = 520
pDoc.Shapes(1).WrapFormat.AllowOverlap = True
pDoc.Shapes(1).WrapFormat.Side = wdWrapNone
pDoc.Shapes(1).WrapFormat.Type = 3
pDoc.Shapes(1).RelativeHorizontalPosition = wdRelativeVerticalPositionMargin
pDoc.Shapes(1).RelativeVerticalPosition = wdRelativeVerticalPositionMargin
pDoc.Shapes(1).Left = wdShapeCenter
pDoc.Shapes(1).Top = wdShapeCenter
End Sub
解决方案
here is the link http://codeconverter.sharpdevelop.net/SnippetConverter.aspx
Try this code (not a translator): [^].
Any effort? If you Google[^], there are already many online convertors available.
This one has worked fine for me over the years:
http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]
这篇关于如何将以下vb代码转换为c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文