吸毒者和二传手从vb 6到vb .net

时间:2010-10-01 19:59:59

标签: vb.net

如何转换以下内容?我正在将vb 6应用程序移植到vb .net。

Public Property Get Width() As Long
   Width = m_lWidth
End Property
Public Property Let Width(ByVal value As Long)
   m_lWidth = value
End Property
Public Property Get Height() As Long
   Height = m_lHeight
End Property
Public Property Let Height(ByVal value As Long)
   m_lHeight = value
    End Property

Public Property Get PartHeight(Optional ByVal eWidthOptions As THEMESIZE = TS_TRUE) As Long
   Dim tSize As SIZE
   Dim tR As RECT
   Dim hTheme As Long
   Dim lR As Long
   hTheme = OpenThemeData(m_hWnd, StrPtr(m_sClass))
   If (hTheme) Then
      lR = GetThemePartSize(hTheme, m_hDC, m_lPartId, m_lStateId, tR, eWidthOptions, tSize)
      If (lR = S_OK) Then
         PartHeight = tSize.cY
      Else
         pFailed "Failed to read part size for class '" & m_sClass & "', partId=" & m_lPartId & ", stateId=" & m_lStateId, lR
      End If
      CloseThemeData hTheme
   Else
      pFailed "No theme data for class '" & m_sClass & "'", Err.LastDllError
   End If
End Property

由于

我正在尝试移植: http://www.vbaccelerator.com/home/vb/code/libraries/xp_visual_styles/drawing_with_xp_visual_styles/VB6_Theme_Explorer.asp

2 个答案:

答案 0 :(得分:6)

VB6中的代码:

Public Property Get Width() As Long
   Width = m_lWidth
End Property
Public Property Let Width(ByVal value As Long)
   m_lWidth = value
End Property

...在VB.NET中等效于此:

Public Property Width() As Integer
    Get
        Return m_lWidth
    End Get
    Set(ByVal Value As Integer)
        m_lWidth = Value
    End Set
End Property

答案 1 :(得分:0)

如果您只关心这些属性,可以查看这个link到MSDN的VB.NET属性。