Learned something new too: never knew the scale has influence on the way DirectX renders things? Or maybe it's something in my code. but if I put it on userscale and 320x240, it is rendered that way. Maybe I'm using ScaleWidth somewhere. Funny though :)
Okay, it works fine now, the solution was - and here it comes - to resize your window after the device reset instead of before. I always thought you had to resize your window before the change, but guess not.
I updated your code a bit:
Public Sub CalcBorders()
With frmMain
.ScaleMode = vbTwips
BorderHeight = .Height - .ScaleHeight
BorderWidth = .Width - .ScaleWidth
.ScaleMode = vbPixels
End With
End Sub
Public Sub ResizeClient(Width As Integer, Height As Integer) With frmMain
.Width = .ScaleX(Width, vbPixels, vbTwips) + BorderWidth
.Height = .ScaleY(Height, vbPixels, vbTwips) + BorderHeight
End With
End Sub
since I'm using Pixels.