一样的,使用
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);
获得其他窗体的位置,然后可以使用
Form1->SetBound(...)
设置窗体的位置
要在mouse的拖放事件中处理就是了
Answer:
You can remove a form's caption by setting BorderStyle to bsDialog and overriding the CreateParams function of the form. Inside CreateParams, you clear the WS_CAPTION bits from Params.Style.
Step 1: Add the CreateParams prototype to the form class.
void __fastcall TForm1::CreateParams(TCreateParams ¶ms)
{
TForm::CreateParams(Params); // call base class first
Params.Style &= ~WS_CAPTION; // then clear caption bit
}
Note: WS_CAPTION is defined in \INCLUDE\WINRESRC.H as
In Windows 3.X, using WS_CAPTION got you a border and a title bar, but not a dialog frame. This meant that having a border and a dialog frame were mutually exclusive. Clearing WS_CAPTION would remove both the title and the border in a Windows 3 application. In these apps, you would remove the title bar by clearing only the WS_DLGFRAME portion in conjunction with utilizing the WS_POPUP style. Win32 offers a new set of extended windows styles. You can use extended window styles to create a window with a dialog frame, a border, and no title bar.
This combination produces a window with a border and a dialog frame whenever you specify bsDialog as the BorderStyle. We clear WS_CAPTION when we override CreateParams, but the form retains its border because of the assignment to the ExStyle. The assignment to ExStyle does not happen when you set BorderStyle to something other than bsDialog, which means you should stick with the bsDialog style when utilizing the code from this FAQ.
Note: If you need a resizable, captionless form, change CreateParams like this:
void __fastcall TForm1::CreateParams(TCreateParams ¶ms)
{
TForm::CreateParams(Params); // call base class first
Params.Style &= ~WS_DLGFRAME;
Params.Style |= WS_POPUP;
}
This code always works, without regard to the BorderStyle property of the form. However, it is less intuitive than clearing the WS_CAPTION bits.