http://topic.csdn.net/t/20020430/08/690485.html
如何移动控件,在DELPHI中见过在回答的,在C++中无人能答吗?
http://topic.csdn.net/u/20070711/12/34bb1b52-98a3-4fe5-8ff1-cd2bc38b7574.html
在程序运行时,怎么在按住鼠标左键的情况下移动控件 ??
答:
运行时控件的移动可以用
int __fastcall Perform(Cadinal Msg, int WParam, int LParam)
例子:
void __fastcall TForm1::Edit1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
WORD SC_DragMove = 0xF012 ;
ReleaseCapture() ;
((TWinControl*)Sender)-> Perform(WM_SYSCOMMAND, SC_DragMove, 0) ;
}
//可改变SC_DragMove的值以测试效果
急::怎么样在运行时移动控件位置。。。
http://topic.csdn.net/t/20011026/11/341233.html
问:
急::怎么样在运行时移动控件位置。。。
是动态创建的组件..
答:
各位大虾。。
终于找到了。。。
在MouseDown事件中写。。。
ReleaseCapture();
SendMessage(Control-> Handle,WM_NCLBUTTONDOWN,HTCAPTION,NULL);
就可了。。
如何实现鼠标移动控件?(VB版)
http://topic.csdn.net/t/20020610/17/792415.html
要求:
1. 移动到新位置后控件与鼠标的相对位置不变。
2. 要可以实现:在同一个控件里移动;在不同控件里移动。
答:
'移动 command1 希望对你有点用
Private Declare Function ReleaseCapture Lib "user32 " () As Long
Private Declare Function SendMessage Lib "user32 " Alias
"SendMessageA " (ByVal hWnd As Long, ByVal wMsg As
Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const HTCAPTION = 2
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage Command1.hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0
End If
End Sub