程序代码:
Private Sub Form_Load() Dim fwidth As Long, fheight As Long Dim rval As Long, nhwnd As Long fwidth = Me.Width / Screen.TwipsPerPixelX fheight = Me.Height / Screen.TwipsPerPixelY 'Create Round Rectangular Region nhwnd = CreateRoundRectRgn(0, 0, fwidth - 25, fheight - 25, fwidth - 50, fheight - 50)
关键在这两句
fwidth = Me.Width / Screen.TwipsPerPixelX
fheight = Me.Height / Screen.TwipsPerPixelY
或者去看官方的帮助,注意in device units
https://msdn.