![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3
![]() |
Moving Form
Hi there...
![]() How can I drag a form that doesn't have a titlebar? |
|
|
|
|
|
#2 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 249
Rep Power: 4
![]() |
what OS and compiler are you using. could you give me info about what your trying to do
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3
![]() |
Using XP, with C++ Builder.
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3
![]() |
I planning to do a window that is basicaly an image... so it'll not have the titlebar, and i want to make it move if i press the left button of the mouse and drag it.
|
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3
![]() |
you must code it by yourself... nobody will do it for you.
|
|
|
|
|
|
#6 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
Paradox: you'll need to capture the WM_MOUSEDOWN, WM_MOUSEMOVE and WM_MOUSEUP events, and then find out how far the mouse moves by, well... I can't quite remember, but I'm pretty sure it was easy enough . Anyway, basically, what you do is set a flag to true in WM_MOUSEDOWN and false in WM_MOUSEUP, and then measure the distance travelled and use some weird function to move the window. I can't quite remember much beyond that, having abandoned Windows C++ programming in favour of C#, but Google should get you the rest of the way. |
|
|
|
|
|
|
#7 |
|
Programmer
Join Date: Oct 2005
Location: Portugal
Posts: 53
Rep Power: 3
![]() |
This is how my code looks right now:
void __fastcall TForm1::BackgroundMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
if ( Shift.Contains(ssLeft) ) // this tests if we are pressing the left button of the mouse
{
Form1->Left = Mouse->CursorPos.x;
Form1->Top = Mouse->CursorPos.y;
}
}This works... but not very well... How do I calculate the distance travelled? Thanks ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|