Board index » cppbuilder » form->borderstyle

form->borderstyle


2007-01-15 08:54:27 AM
cppbuilder112
hi if i put form->borderstyle to none is there a way to move the form around
the screen using drag and drop
similarly in the way we could drag and drop it when there was the window
frame?
thank you
 
 

Re:form->borderstyle

Handle the WM_NCHITTEST message and return HTCAPTION
. Ed
Quote
bill wrote in message
news: XXXX@XXXXX.COM ...

hi if i put form->borderstyle to none is there a way to move the form
around the screen using drag and drop similarly in the way we could drag
and drop it when there was the window frame?
 

Re:form->borderstyle

could you please explain what you mean?
i was thinking of puting the form->borderstyle to none so i wouldnt have the
windows frame,and then put 4 panels
at the edges to make it look like a window.the reason for me doing this is
that i can put my own minimize,maximize buttons this way
,i can do actually whatever i want with the panels.so is there a way that
when i user clicks on the top panel the form begins to move(like
drag and drop?)
thks
"Ed Mulroy" < XXXX@XXXXX.COM >wrote in message
Quote
Handle the WM_NCHITTEST message and return HTCAPTION

. Ed

>bill wrote in message
>news: XXXX@XXXXX.COM ...
>
>hi if i put form->borderstyle to none is there a way to move the form
>around the screen using drag and drop similarly in the way we could drag
>and drop it when there was the window frame?


 

{smallsort}

Re:form->borderstyle

I believe Ed means this:
// add this to the form's declaration in the header
protected:
void WmNcHitTest(TWMNCHitTest& Message);
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_NCHITTEST, TWMNCHitTest, WmNcHitTest)
END_MESSAGE_MAP(TForm)
// add this to the form's cpp file
void TForm1::WmNcHitTest(TWMNCHitTest& Message)
{
Message.Result = HTCAPTION;
}
However, from my tests this trick will only work when the mouse is clicked
directly on the form. If the mouse is over any child windowed control then
the form doesn't receive the WM_NCHITTEST message. For that to work you can
try something like the following. Add a panel to the top of the form (name
it CaptionBarPanel). This will serve as your new "caption bar". Add an
event handler for the OnMouseDown event and add the following code to the
handler:
ReleaseCapture();
PostMessage(Handle, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, 0);
HTH,
- Clayton