views:

33

answers:

2

How do I convert the following? I'm porting a vb 6 app to 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

Thanks

I'm trying to port: http://www.vbaccelerator.com/home/vb/code/libraries/xp_visual_styles/drawing_with_xp_visual_styles/VB6_Theme_Explorer.asp

A: 

If you are just concerned about the properties, you can check out this link to MSDN about VB.NET properties.

bde
+1  A: 

This code in 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

...is equivalent of this in 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
Fredrik Mörk
Yes, but `As Integer`.
GSerg
@GSerg: yes, of course. Didn't use VB.NET in a long time so I had forgotten that pitfall (and so I went right into it...). Thanks for the correction, answer updated.
Fredrik Mörk