2013-07-31 93 views
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 
+0

讓再有代碼,有幾行的上方和下方... –

+0

昏暗的BDR,X短 昏暗下一頁末,NewY爲雙 昏暗OldX,OldY爲雙 昏暗GridHeight,GridWidth爲雙 在一起Dim mvarPictureBox As System.Windows.Forms.PictureBox – user1722353

+0

這也是無效的VB6代碼。如果您想要在多行中打破長整型語句,則必須在行尾使用下劃線_。 –

回答