コントロールの表示座標の移動方法
Posted: 2008年4月21日(月) 19:24
Static1の位置をプログラムにて移動させたいのですが、方法を教えてください。
コード: 全て選択
SetWindowPos(GetDlgItem(hMainWnd,Static1),0,100,100,0,0,SWP_NOSIZE)
コード: 全て選択
Sub MainWnd_CommandButton2_Click()
Dim rc As RECT,pa As POINTAPI
Dim buf[1023] As Byte'表示用
'スクリーン座標の取得
GetWindowRect(GetDlgItem(hMainWnd,Static1),rc)
'クライアント座標(ウインドウ座標)へ変換
pa.x=rc.left
pa.y=rc.top
ScreenToClient(hMainWnd,pa)
'表示
wsprintf(buf,Ex"Screen : %d x %d\r\nWindow : %d x %d",rc.top,rc.left,pa.x,pa.y)
MessageBox(hMainWnd,buf,"pos",MB_OK)
End Sub