window move

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DaveL

    window move

    is there a way to stop the user from moving the window
    when the caption /title is visible

    ?

    DaveL


  • Lee

    #2
    Re: window move

    A quick and easy way to do this would be to record what the top and
    left values of the form is and this connect to the Move event and
    reset the top and left values to the ones you saved.

    There are probably better ways, but this is a quick and dirty way to
    do it.

    int MyTop = 0;
    int MyLeft = 0;

    private void Form1_Load(obje ct sender, EventArgs e)
    {
    MyTop = this.Top;
    MyLeft = this.Left;
    }

    private void Form1_Move(obje ct sender, EventArgs e)
    {
    if (MyTop != 0 && MyLeft != 0)
    {
    this.Top = MyTop;
    this.Left = MyLeft;
    }
    }

    Hope this helps,

    L. Lee Saunders
    Playing with old ideas/concepts using the newest tools!

    Comment

    • daveL

      #3
      Re: window move

      thanks alot
      thats the best i found so far, other than using
      a wndproc

      DaveP

      "Lee" <saunderl@hotma il.comwrote in message
      news:ac7e0980-ecb4-4f60-a6a4-87c0d059bcfc@p4 9g2000hsd.googl egroups.com...
      >A quick and easy way to do this would be to record what the top and
      left values of the form is and this connect to the Move event and
      reset the top and left values to the ones you saved.
      >
      There are probably better ways, but this is a quick and dirty way to
      do it.
      >
      int MyTop = 0;
      int MyLeft = 0;
      >
      private void Form1_Load(obje ct sender, EventArgs e)
      {
      MyTop = this.Top;
      MyLeft = this.Left;
      }
      >
      private void Form1_Move(obje ct sender, EventArgs e)
      {
      if (MyTop != 0 && MyLeft != 0)
      {
      this.Top = MyTop;
      this.Left = MyLeft;
      }
      }
      >
      Hope this helps,
      >
      L. Lee Saunders
      http://oldschooldotnet.blogspot.com

      Comment

      • Jeff Johnson

        #4
        Re: window move

        "DaveL" <dvs_bis@sbcglo bal.netwrote in message
        news:zYNNk.5070 $c45.1289@nlpi0 65.nbdc.sbc.com ...
        is there a way to stop the user from moving the window
        when the caption /title is visible
        When asking this question it should always be followed by "and is it a good
        idea to do this?" Users expect to be able to move windows. You need a
        spectacularly good reason to prevent them from doing so.


        Comment

        • DaveL

          #5
          Re: window move

          the window is assigned to a control (textbox)
          and should not be moved
          Normally i dont care what users do. they can open up as many windows of my
          application that they wish

          but this is a custom control ownd by a textbox
          Hence Not movable

          DaveL


          "Jeff Johnson" <i.get@enough.s pamwrote in message
          news:uRl3nIdOJH A.4576@TK2MSFTN GP06.phx.gbl...
          "DaveL" <dvs_bis@sbcglo bal.netwrote in message
          news:zYNNk.5070 $c45.1289@nlpi0 65.nbdc.sbc.com ...
          >
          >is there a way to stop the user from moving the window
          >when the caption /title is visible
          >
          When asking this question it should always be followed by "and is it a
          good idea to do this?" Users expect to be able to move windows. You need a
          spectacularly good reason to prevent them from doing so.
          >

          Comment

          Working...