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. Dragging the form.... please help!

Dragging the form.... please help!

Scheduled Pinned Locked Moved C#
helpcsharpcssquestion
5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi there, I am creating a Windows form, of which, I have removed the title bar which addresses the Minimize, maximize and close buttons, by defining the FormBorderStyle entry as None. However, I have added the minimize and close button on the top right corner of my Border/Title less form. But the problem is, when I try to drag the form from one location of the desktop to another, it doesn't seem to move and remains static in its original location. Can anyone offer me a solution to this? Your help will greatly be appreciated, Thanks, Rajdeep.NET

    M 1 Reply Last reply
    0
    • L Lost User

      Hi there, I am creating a Windows form, of which, I have removed the title bar which addresses the Minimize, maximize and close buttons, by defining the FormBorderStyle entry as None. However, I have added the minimize and close button on the top right corner of my Border/Title less form. But the problem is, when I try to drag the form from one location of the desktop to another, it doesn't seem to move and remains static in its original location. Can anyone offer me a solution to this? Your help will greatly be appreciated, Thanks, Rajdeep.NET

      M Offline
      M Offline
      MeekLogic
      wrote on last edited by
      #2

      Just add this code to your form :)

          protected override void WndProc(ref Message m)
          {
              if (m.Msg == 0x0084 /\*WM\_NCHITTEST\*/)
              {
                  m.Result = (IntPtr)2;   // HTCLIENT
                  return;
              }
              base.WndProc(ref m);
          }
      
      E L 2 Replies Last reply
      0
      • M MeekLogic

        Just add this code to your form :)

            protected override void WndProc(ref Message m)
            {
                if (m.Msg == 0x0084 /\*WM\_NCHITTEST\*/)
                {
                    m.Result = (IntPtr)2;   // HTCLIENT
                    return;
                }
                base.WndProc(ref m);
            }
        
        E Offline
        E Offline
        Emilio Garavaglia
        wrote on last edited by
        #3

        Here's where .net is really useful !

        2 bugs found. > recompile ... 65534 bugs found. :doh:

        1 Reply Last reply
        0
        • M MeekLogic

          Just add this code to your form :)

              protected override void WndProc(ref Message m)
              {
                  if (m.Msg == 0x0084 /\*WM\_NCHITTEST\*/)
                  {
                      m.Result = (IntPtr)2;   // HTCLIENT
                      return;
                  }
                  base.WndProc(ref m);
              }
          
          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi T_Lokzz, Thanks for your help man :-D , the code really worked out!!!!! I'm feeling so happy.... thank you once again,:thumbsup: Rajdeep.NET

          M 1 Reply Last reply
          0
          • L Lost User

            Hi T_Lokzz, Thanks for your help man :-D , the code really worked out!!!!! I'm feeling so happy.... thank you once again,:thumbsup: Rajdeep.NET

            M Offline
            M Offline
            MeekLogic
            wrote on last edited by
            #5

            No problem man I was really pissed when I first realized that also and found that code somewhere Google searching :)

            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