Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Moving app window with FormBorderStyle set to None

Moving app window with FormBorderStyle set to None

Scheduled Pinned Locked Moved C#
csharptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QzRz
    wrote on last edited by
    #1

    Hello I am creating an application with no FormBorder, and I want the user to be able to move the application as if there was FormBorders. It is something similar to Microsoft Live Messenger (In MLM you can move the window by holding down the left mouse button) So I want to move the application when the user holds down the left mouse button on a picturebox. Is there any way to do that with C#? If so can you tell me an article which describe it, or maybe tell me how to do it? Thanks QzRz

    R A 2 Replies Last reply
    0
    • Q QzRz

      Hello I am creating an application with no FormBorder, and I want the user to be able to move the application as if there was FormBorders. It is something similar to Microsoft Live Messenger (In MLM you can move the window by holding down the left mouse button) So I want to move the application when the user holds down the left mouse button on a picturebox. Is there any way to do that with C#? If so can you tell me an article which describe it, or maybe tell me how to do it? Thanks QzRz

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      This can be done by handling the WM_NCHITTEST message and returning HTCAPTION when the cursor is over the picturebox. Returning HTCAPTION regardless of the cursor position will allow the user to drag your form by clicking anywhere within it. /ravi

      My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      1 Reply Last reply
      0
      • Q QzRz

        Hello I am creating an application with no FormBorder, and I want the user to be able to move the application as if there was FormBorders. It is something similar to Microsoft Live Messenger (In MLM you can move the window by holding down the left mouse button) So I want to move the application when the user holds down the left mouse button on a picturebox. Is there any way to do that with C#? If so can you tell me an article which describe it, or maybe tell me how to do it? Thanks QzRz

        A Offline
        A Offline
        AB7771
        wrote on last edited by
        #3

        Use the Mouse Down, MouseMove and MouseUp events, Capture the mouse oc-ordinates when the mouse is down and moving, and set the location of the form to the mouse location (consider the offset) i hope that works for you. Regards, Pramod

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups