locked
ES_AUTOHSCROLL issue RRS feed

  • Question

  • ES_AUTOHSCROLL automatically scrolls text to the right by 10 characters when the user types a character at the end of the line ,can I change this 10 character limit.
    regards,
    winningbrew
    Wednesday, May 27, 2009 12:15 PM

All replies

  • Hi winningbrew,

    For managed code, we can change MaxLength property to enlarge max length in KeyDown event. Like the code below:
      private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (this.textBox1.Text.Length == 10)
                {
                    this.textBox1.MaxLength = 100;
                }
            }
        }

    For native code, we can handle WM_KeyDown message and check whether its text is 10, if it is use SetLimitText to set max length.

    If I have misunderstood you, please let me know.



    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Friday, May 29, 2009 6:53 AM
  • Hi,
         I am not trying to set number of text character input to edit cntl but nuber of character by which text should horizontally scroll when the user types a character at the end of the line while using ES_AUTOHSCROLL.

    regards,
    winningbrew
    Friday, May 29, 2009 8:38 AM
  • Hi winningbrew,

    OK, I know your problem. You want to set edit control width programmatically. If I have misunderstood you, please let me know.


    For managed code, we can change width property to enlarge length in KeyDown event. Like the code below:
      private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (this.textBox1.Text.Length == 10)
                {
                    this.textBox1.Width= 200;
                }
            }
        }

    For native code, please see:
    http://www.codeguru.com/forum/showthread.php?t=270046
    http://wwwusers.brookes.ac.uk/p0071643/resize.htm


    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Tuesday, June 2, 2009 3:30 AM