Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
' 画面の幅と高さを取得するための定数
Const SM_CXSCREEN = 0
Const SM_CYSCREEN = 1
'フォームのサイズを調整する次に、フォームのLoadイベントまたはOpenイベント内で、以下のようなコードを使用してフォームのサイズを調整します。
Private Sub Form_Load()
Dim screenWidth As Long
Dim screenHeight As Long
' 画面の解像度を取得
screenWidth = GetSystemMetrics32(SM_CXSCREEN)
screenHeight = GetSystemMetrics32(SM_CYSCREEN)
' フォームのサイズを画面解像度に合わせて調整
Me.Move 0, 0, screenWidth, screenHeight
End Sub
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme