PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2008 [RESOLVED] How can i make a form non movable?-VBForums
Results 1 to 9 of 9

Thread: [RESOLVED] How can i make a form non movable?

  1. #1

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,347

    Resolved [RESOLVED] How can i make a form non movable?

    In VB6 there was a property on the form called movable that if set to false meant that the form could only be moved through code ... just wondering how i can do something like this in .net ...

    i don't want anything that flickers either like:

    vb Code:
    1. Private Sub Form1_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
    2.         Me.Location = New Point(100, 100)
    3.     End Sub

    the above flickers occasionally when the form is moved

    Thanks
    Kris

  2. #2
    Junior Member PESHuk's Avatar
    Join Date
    Mar 2010
    Posts
    25

    Re: How can i make a form non movable?

    I think this is right, go to the form properties and set the Location of the form(ie X = 100 Y=100) then click the Lock option to True

  3. #3
    Hyperactive Member BadgerBadger's Avatar
    Join Date
    Aug 2009
    Location
    Wales
    Posts
    382

    Re: How can i make a form non movable?

    Quote Originally Posted by PESHuk View Post
    I think this is right, go to the form properties and set the Location of the form(ie X = 100 Y=100) then click the Lock option to True
    I'm pretty sure the Lock property is only for the designer.

    I'm not sure on the specifics, but I think you will need to override WndProc and capture the WM_MOVING message.
    "The only thing that interferes with my learning is my education."

  4. #4
    Junior Member PESHuk's Avatar
    Join Date
    Mar 2010
    Posts
    25

    Re: How can i make a form non movable?

    yeah i your right Badger i have just checked it and it only locks it in designer

  5. #5
    Lively Member zexor's Avatar
    Join Date
    Mar 2010
    Posts
    68

    Re: How can i make a form non movable?

    You could just make the form borderless.

    Or hide the control box, min max button and with no text title. It would have a raised border but u cant drag it.

    If you want the boxes and the bar but don't want it movable, then u need to create your own class that inherits the form.
    Last edited by zexor; Mar 25th, 2010 at 09:52 AM.

  6. #6
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,828

    Re: How can i make a form non movable?

    Quote Originally Posted by zexor View Post
    You could just make the form borderless.

    Or hide the control box, min max button and with no text title. It would have a raised border but u cant drag it.
    A clever guy could still move it. BadgerBadger's idea is probably the way to go.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  7. #7
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: How can i make a form non movable?

    You can remove the move option from the contextmenu that appears when you click the icon of the form using some API. If you do that, you can no longer move the form in any way (except probably code). I think there's a thread in the codebank on this subject, by jmcilhinney.

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    23,126

    Re: How can i make a form non movable?


  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,705

    Re: How can i make a form non movable?

    Quote Originally Posted by NickThissen View Post
    You can remove the move option from the contextmenu that appears when you click the icon of the form using some API. If you do that, you can no longer move the form in any way (except probably code). I think there's a thread in the codebank on this subject, by jmcilhinney.
    http://www.vbforums.com/showthread.php?t=351533

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width