Board index » delphi » Dragable panel = Making panel on click drag Form1

Dragable panel = Making panel on click drag Form1

I have a panel, how do i get it to resize with wize as someone re-sizes my
forum and how do i get it so on click of the panel it starts dragging Form1?

plz Help

thX

dAn

 

Re:Dragable panel = Making panel on click drag Form1


In comp.lang.pascal.delphi.misc, on 17 Oct 2002, DanB
announced:

Quote
> I have a panel, how do i get it to resize with wize as
> someone re-sizes my forum...

Hi dAn,

To make the panel resize with your form, put something in the
form's OnResize method - ie (this is off the top of my head,
apologies for mistakes ;):

Form1.OnResize(Sender: Object);
begin
        // ClientWidth/Height are the usable area of the form
        // They already take into consideration a MainMenu
        // and border width and titlebar, but not toolbar
        // or statusbar.

        // the panel's left position is 10 say,
        // let's make it the width of the form with a 10 pixel
        // gap either side.
        myPanel.Width:=Form1.ClientWidth - 20;

        // Let's position the panel 1/4 of the way from the
        // top of the form, and make it half the height of
        // the form.
        myPanel.Top:=(Form1.ClientHeight shr 2);
        myPanel.Height:=(Form1.ClientHeight shr 1);
end;

Quote
> ... and how do i get it so on click
> of the panel it starts dragging Form1?

That's a bit harder and is something I haven't tried before, but
I know you can do it.  Try playing with the form and the panel's
OnDragOver, OnStartDrag, OnEndDrag, OnMouseMove methods, or
perhaps just have a search through google, I'm sure the question
has been asked before.  Sorry I can't help more there.

Regards

OgO
--
My Freeware: http://qjc.cjb.net/freeware.html
My Win9x Cursors: http://qjc.cjb.net/cursors.html
ICQ: 12889482 - AIM/Yahoo: quentisl - MSN: quent...@mail.com
I left my Glasses in my email - you better take them out!

Re:Dragable panel = Making panel on click drag Form1


In article <mXnr9.40787$OB5.3084...@newsread2.prod.itd.earthlink.net>, "DanB"

Quote
<dfana...@hotmail.com> writes:
>how do i get it so on click of the panel it starts dragging Form1?

Use the panel's OnMouseDown event handler, and send a dragmove message to the
form.

procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
                                 Shift: TShiftState; X, Y: Integer);
const
  SC_DRAGMOVE = $F012;
begin
  ReleaseCapture;  // ... from any other control
  Self.Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
end;

Alan Lloyd
alangll...@aol.com

Re:Dragable panel = Making panel on click drag Form1


Quote
"DanB" <dfana...@hotmail.com> wrote in message

news:mXnr9.40787$OB5.3084086@newsread2.prod.itd.earthlink.net...
Quote
> I have a panel, how do i get it to resize with wize as someone re-sizes my
> forum and how do i get it so on click of the panel it starts dragging

Form1?

see
http://groups.google.com/advanced_group_search

words
danb circular form

procedure TForm1.FormResize(Sender: TObject);
begin
panel1.SetBounds(0,0,clientwidth,20);
end;

const  sc_dragmove = $F012;
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  releasecapture;
  perform(wm_syscommand, sc_dragmove, 0);
end;

plink

Re:Dragable panel = Making panel on click drag Form1


WM_NCLBUTTONDOWN  with  HTCAPTION also works

On Fri, 18 Oct 2002 00:03:04 +0930, "Terry Russell"

Quote
<trochi...@optusnet.com.au> wrote:
>"DanB" <dfana...@hotmail.com> wrote in message
>news:mXnr9.40787$OB5.3084086@newsread2.prod.itd.earthlink.net...
>> I have a panel, how do i get it to resize with wize as someone re-sizes my
>> forum and how do i get it so on click of the panel it starts dragging
>Form1?

>see
>http://groups.google.com/advanced_group_search

>words
>danb circular form

>procedure TForm1.FormResize(Sender: TObject);
>begin
>panel1.SetBounds(0,0,clientwidth,20);
>end;

>const  sc_dragmove = $F012;
>procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
>  Shift: TShiftState; X, Y: Integer);
>begin
>  releasecapture;
>  perform(wm_syscommand, sc_dragmove, 0);
>end;

>plink

Other Threads