custom "drag bar"

I have an application where the it doesnt have the top bar that you use for draging the application the application has a image across the whole width of it. Now Im trying to make it to where the top 0-10 pixels are used for draging any ideas how to do that?

Tom
T0maszAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wavgetCommented:
Put a panel at the top of the form where you want the user to be able to drag the form. Then add the follwoing code:

procedure TForm1.Panel1MouseDown(Sender: TObject; Button:
TMouseButton; Shift: TShiftState; X, Y: Integer);
const SC_DRAGMOVE = $F012;
begin
  if Button = mbLeft then
  begin
    ReleaseCapture;
    Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
  end;
end;

Basically, all the method does is send a WM_SYSCOMMAND message to the form with the SC_DRAGMOVE constant to perform a drag move.
0
Slick812Commented:
hello T0masz, I think that  wavget  code will just move the panel? ? I have used code like this for and Image covered form, you will need to get the Form's OnMouseDown  event -


procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
hSysMenu: THandle;
begin
if Button = mbLeft then
if PtInRect(Rect(4,3,22,21), Point(X,Y)) then
  begin
  // this will show a Popup menu like the system Icon menu
  PopupMenu1.Popup(Left+4, Top+27);
  end else
  // you can define your Drag Rectangle to suit your form and Image and drag area
  // maybe something like
  if PtInRect(Rect(23,3{border},Width-6, 18), Point(X,Y)) then
    begin
    ReleaseCapture;
    Form1.perform(WM_SysCommand, $F012, 0);
    end;
end;

 - - - - - - - - - - - - - - -  - - - - - - - - -

ask questions if you need more
0
Lee_NoverCommented:
how about simulating a drag on the title ..

OnMouseDown:
ReleaseCapture;
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Eddie ShipmanAll-around developerCommented:
Lee_Nover has the correct answer!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.