K
kurt
I have a program I’ve written in VB-4 and am now trying to re-write in VB..NET 2005
Some of what I can’t seem to figure out is how do I transcribe the following VB-4 code to run in my VB.NET program, any and all help is appreciated.Thank you.
'*************************************************
' Keep within screen viewing
Dim maxNormalWidth As Long, maxNormalHeight As Long
Dim deskArea As RECT
Call SystemParametersInfo(SPI_GETWORKAREA, 0&, deskArea, 0&)
deskArea.Left = ScaleX(deskArea.Left, vbPixels, vbTwips)
deskArea.Top = ScaleY(deskArea.Top, vbPixels, vbTwips)
deskArea.Right = ScaleX(deskArea.Right, vbPixels, vbTwips)
deskArea.Bottom = ScaleY(deskArea.Bottom, vbPixels, vbTwips)
maxNormalWidth = (deskArea.Right - deskArea.Left)
maxNormalHeight = (deskArea.Bottom - deskArea.Top)
If Me.Width > maxNormalWidth Then
Me.Width = maxNormalWidth
End If
If Me.Height > maxNormalHeight Then
Me.Height = maxNormalHeight
End If
Me.Left = deskArea.Left + (deskArea.Right - deskArea.Left - Me.Width) /2
Me.Top = deskArea.Top + (deskArea.Bottom - deskArea.Top - Me.Height) / 2
'**************************************************
Some of what I can’t seem to figure out is how do I transcribe the following VB-4 code to run in my VB.NET program, any and all help is appreciated.Thank you.
'*************************************************
' Keep within screen viewing
Dim maxNormalWidth As Long, maxNormalHeight As Long
Dim deskArea As RECT
Call SystemParametersInfo(SPI_GETWORKAREA, 0&, deskArea, 0&)
deskArea.Left = ScaleX(deskArea.Left, vbPixels, vbTwips)
deskArea.Top = ScaleY(deskArea.Top, vbPixels, vbTwips)
deskArea.Right = ScaleX(deskArea.Right, vbPixels, vbTwips)
deskArea.Bottom = ScaleY(deskArea.Bottom, vbPixels, vbTwips)
maxNormalWidth = (deskArea.Right - deskArea.Left)
maxNormalHeight = (deskArea.Bottom - deskArea.Top)
If Me.Width > maxNormalWidth Then
Me.Width = maxNormalWidth
End If
If Me.Height > maxNormalHeight Then
Me.Height = maxNormalHeight
End If
Me.Left = deskArea.Left + (deskArea.Right - deskArea.Left - Me.Width) /2
Me.Top = deskArea.Top + (deskArea.Bottom - deskArea.Top - Me.Height) / 2
'**************************************************