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. Other Discussions
  3. Clever Code
  4. Location Change

Location Change

Scheduled Pinned Locked Moved Clever Code
8 Posts 7 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.
  • K Offline
    K Offline
    Khaniya
    wrote on last edited by
    #1

    try this

    private void Form_Load(object sender, EventArgs e)
    {
    this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
    this.PayTextBox.Top = this.objChequeTemplate.PayTop;
    this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
    }

    private void PayTextBox_LocationChanged(object sender, EventArgs e)
    {
    objChequeTemplate.PayLeft = ((Control)sender).Left;
    objChequeTemplate.PayTop = ((Control)sender).Top;
    }

    Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

    D C H L A 6 Replies Last reply
    0
    • K Khaniya

      try this

      private void Form_Load(object sender, EventArgs e)
      {
      this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
      this.PayTextBox.Top = this.objChequeTemplate.PayTop;
      this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
      }

      private void PayTextBox_LocationChanged(object sender, EventArgs e)
      {
      objChequeTemplate.PayLeft = ((Control)sender).Left;
      objChequeTemplate.PayTop = ((Control)sender).Top;
      }

      Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      WTF :wtf:

      Dave

      If this helped, please vote & accept answer!

      Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

      1 Reply Last reply
      0
      • K Khaniya

        try this

        private void Form_Load(object sender, EventArgs e)
        {
        this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
        this.PayTextBox.Top = this.objChequeTemplate.PayTop;
        this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
        }

        private void PayTextBox_LocationChanged(object sender, EventArgs e)
        {
        objChequeTemplate.PayLeft = ((Control)sender).Left;
        objChequeTemplate.PayTop = ((Control)sender).Top;
        }

        Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        How?

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

        1 Reply Last reply
        0
        • K Khaniya

          try this

          private void Form_Load(object sender, EventArgs e)
          {
          this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
          this.PayTextBox.Top = this.objChequeTemplate.PayTop;
          this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
          }

          private void PayTextBox_LocationChanged(object sender, EventArgs e)
          {
          objChequeTemplate.PayLeft = ((Control)sender).Left;
          objChequeTemplate.PayTop = ((Control)sender).Top;
          }

          Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

          H Offline
          H Offline
          hammerstein05
          wrote on last edited by
          #4

          I don't get it.

          1 Reply Last reply
          0
          • K Khaniya

            try this

            private void Form_Load(object sender, EventArgs e)
            {
            this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
            this.PayTextBox.Top = this.objChequeTemplate.PayTop;
            this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
            }

            private void PayTextBox_LocationChanged(object sender, EventArgs e)
            {
            objChequeTemplate.PayLeft = ((Control)sender).Left;
            objChequeTemplate.PayTop = ((Control)sender).Top;
            }

            Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

            L Offline
            L Offline
            LucianPopescu
            wrote on last edited by
            #5

            I didn't tried this but i suppose it doesn't do anything :) after it changes the position it changes back to the initial position, i suppose ...

            1 Reply Last reply
            0
            • K Khaniya

              try this

              private void Form_Load(object sender, EventArgs e)
              {
              this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
              this.PayTextBox.Top = this.objChequeTemplate.PayTop;
              this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
              }

              private void PayTextBox_LocationChanged(object sender, EventArgs e)
              {
              objChequeTemplate.PayLeft = ((Control)sender).Left;
              objChequeTemplate.PayTop = ((Control)sender).Top;
              }

              Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

              A Offline
              A Offline
              AhsanS
              wrote on last edited by
              #6

              Out of memory exception at start up i guess. :^) Ahsan Ullah Senior Software Engineer MCTS 2.0

              1 Reply Last reply
              0
              • K Khaniya

                try this

                private void Form_Load(object sender, EventArgs e)
                {
                this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
                this.PayTextBox.Top = this.objChequeTemplate.PayTop;
                this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
                }

                private void PayTextBox_LocationChanged(object sender, EventArgs e)
                {
                objChequeTemplate.PayLeft = ((Control)sender).Left;
                objChequeTemplate.PayTop = ((Control)sender).Top;
                }

                Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

                C Offline
                C Offline
                Covean
                wrote on last edited by
                #7

                Not tested, but I'm really sure it does the following: It sets the correct top position at startup, but it lets the left position unchanged. If PayTop is not initialized, the window will always be opened at the top of the screen. This will be the execution plan I think:

                this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
                this.PayTextBox.Top = this.objChequeTemplate.PayTop;
                // triggers ->
                objChequeTemplate.PayLeft = ((Control)sender).Left; // left is current left window position
                objChequeTemplate.PayTop = ((Control)sender).Top;
                // returns
                this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
                // triggers ->
                objChequeTemplate.PayLeft = ((Control)sender).Left;
                objChequeTemplate.PayTop = ((Control)sender).Top;

                Greetings Covean

                K 1 Reply Last reply
                0
                • C Covean

                  Not tested, but I'm really sure it does the following: It sets the correct top position at startup, but it lets the left position unchanged. If PayTop is not initialized, the window will always be opened at the top of the screen. This will be the execution plan I think:

                  this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
                  this.PayTextBox.Top = this.objChequeTemplate.PayTop;
                  // triggers ->
                  objChequeTemplate.PayLeft = ((Control)sender).Left; // left is current left window position
                  objChequeTemplate.PayTop = ((Control)sender).Top;
                  // returns
                  this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
                  // triggers ->
                  objChequeTemplate.PayLeft = ((Control)sender).Left;
                  objChequeTemplate.PayTop = ((Control)sender).Top;

                  Greetings Covean

                  K Offline
                  K Offline
                  Khaniya
                  wrote on last edited by
                  #8

                  you got it :)

                  Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim So Smile Please

                  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