locked
How to drag a border less form in C# by holding left mouse click. RRS feed

  • Question

  • Hey there! I am a beginner in C# winform programming. I have made a form with FormborderStyle set to None. i want to add a feature that whenever left mouse button is clicked and held anywhere on the form, user must be able to drag it anywhere he wants... Need help... Because i'm totally newbie... :) Thanks in anticipation
    • Moved by CoolDadTx Monday, January 26, 2015 3:15 PM Winforms related
    Monday, January 26, 2015 9:04 AM

Answers

  • Please refer to the following link for information about how to make a borderless form movable: http://stackoverflow.com/questions/1592876/make-a-borderless-form-movable

    You could call the native SendMessage method using P/Invoke in the MouseDown event handler as described on the link above.

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer.

    • Proposed as answer by Paul Ishak Tuesday, January 27, 2015 3:57 AM
    • Marked as answer by Carl Cai Tuesday, February 3, 2015 10:33 AM
    Monday, January 26, 2015 12:10 PM

All replies

  • Try with the Window.DragMove method.

    You can find more info on MSDN.

    Monday, January 26, 2015 9:58 AM
  • Please refer to the following link for information about how to make a borderless form movable: http://stackoverflow.com/questions/1592876/make-a-borderless-form-movable

    You could call the native SendMessage method using P/Invoke in the MouseDown event handler as described on the link above.

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer.

    • Proposed as answer by Paul Ishak Tuesday, January 27, 2015 3:57 AM
    • Marked as answer by Carl Cai Tuesday, February 3, 2015 10:33 AM
    Monday, January 26, 2015 12:10 PM
  • Try with the Window.DragMove method.

    You can find more info on MSDN.

    Thats for WPF.


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Tuesday, January 27, 2015 3:57 AM