1
我升级代码从VB 6到VB.NET,和下面的代码给我一个错误:转换VB 6代码VB.NET
(VB6.PixelsToTwipsX(mvarPicture.ClientRectangle.Width) - (BDR + X),
VB6.PixelsToTwipsY(mvarPicture.ClientRectangle.Height) - (BDR + X)),
mvarBorderColor,
B
的错误是:
Error 6 End of statement expected.
任何人都可以帮助我吗?
这是全码:
Public Sub Draw()
Dim BDR, X As Short
Dim NewX, NewY As Double
Dim OldX, OldY As Double
Dim GridHeight, GridWidth As Double
Dim mvarPictureBox As System.Windows.Forms.PictureBox
On Error GoTo NoPicBox ' In case the PicBox isn't set yet
'UPGRADE_ISSUE: PictureBox property mvarPictureBox.AutoRedraw was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
If mvarPicture.AutoRedraw = False Then mvarPicture.AutoRedraw = True
'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Cls was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
mvarPicture.Cls()
BDR = mvarPictureBox.BorderStyle
'UPGRADE_ISSUE: PictureBox property mvarPictureBox.ScaleMode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
If mvarPicture.ScaleMode <> 3 Then mvarPicture.ScaleMode = 3
If System.Drawing.ColorTranslator.ToOle(mvarPictureBox.BackColor) <> System.Drawing.ColorTranslator.ToOle(mvarPicBackground) Then mvarPictureBox.BackColor = mvarPicBackground
If mvarBorderSize > 0 Then
For X = 0 To mvarBorderSize
'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
mvarPicture.Line (X, X) - (VB6.PixelsToTwipsX(mvarPicture.ClientRectangle.Width) - (BDR + X), VB6.PixelsToTwipsY(mvarPicture.ClientRectangle.Height) - (BDR + X)), mvarBorderColor, B
Next X
End If
' Display Grid On Screen
If mvarGridVisible = True Then
For X = 1 To 20
'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
mvarPicture.Line (mvarBorderSize, mvarBorderSize) - ((((VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2))/20) * X), (VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2))), mvarGridColor, B
Next X
For X = 1 To 10
'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
mvarPicture.Line (mvarBorderSize, mvarBorderSize) - ((VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2)), (((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2))/10) * X)), mvarGridColor, B
Next X
End If
If mvarDataCollection.Count() > 0 Then
GridHeight = ((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2))/100) + 0 ' 0-100%
GridWidth = ((VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2))/100) + 0 ' 1-100 Items
Do
If mvarDataCollection.Count() > 100 Then mvarDataCollection.Remove(1)
Loop While mvarDataCollection.Count() > 100
OldX = mvarBorderSize + 2
'UPGRADE_WARNING: Couldn't resolve default property of object mvarDataCollection(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
OldY = ((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2)) - (mvarDataCollection.Item(1) * GridHeight))
For X = 1 To 100
NewX = (VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2)) - ((100 - (X - 1)) * GridWidth)
'UPGRADE_WARNING: Couldn't resolve default property of object mvarDataCollection(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
NewY = ((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2)) - (mvarDataCollection.Item(X) * GridHeight))
NewX = NewX + 2
If NewX < mvarBorderSize Then NewX = mvarBorderSize
If NewY < mvarBorderSize Then NewY = mvarBorderSize
'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
mvarPicture.Line (OldX, OldY) - (NewX, NewY), mvarPicForeground
OldX = NewX : OldY = NewY
If OldX < mvarBorderSize Then OldX = mvarBorderSize
If OldY < mvarBorderSize Then OldY = mvarBorderSize
Next X
End If
NoPicBox:
End Sub
让再有代码,有几行的上方和下方... –
昏暗的BDR,X短 昏暗下一页末,NewY为双 昏暗OldX,OldY为双 昏暗GridHeight,GridWidth为双 在一起Dim mvarPictureBox As System.Windows.Forms.PictureBox – user1722353
这也是无效的VB6代码。如果您想要在多行中打破长整型语句,则必须在行尾使用下划线_。 –