Пример #1
0
        /// <summary>
        /// 当行号输入框中的用户输入的数据改变时引发此事件。
        /// </summary>
        private void CheckedLineNumberTextBoxInput()
        {
            if (this._LineNumberTextBox.Text == this.LineNumberTextBoxLastValue)
            {
                return;
            }

            if (!int.TryParse(this._LineNumberTextBox.Text, out int lineNumber))
            {
                this._LineNumberTextBox.Text = LineNumberTextBoxLastValue;
                return;
            }

            if (this._OnLineNumberChanging != null)
            {
                LineNumberChangingEventArgs lncea = new LineNumberChangingEventArgs(Convert.ToInt32(this._LineNumberTextBox.Text));
                this._OnLineNumberChanging(this, lncea);
                if (lncea.Cancel)
                {
                    this._LineNumberTextBox.Text = this.LineNumberTextBoxLastValue;
                    return;
                }
            }
            this.LineNumberTextBoxLastValue = this._LineNumberTextBox.Text;
        }
Пример #2
0
 void pageNavigation1_OnLineNumberChanging(object sender, LineNumberChangingEventArgs e)
 {
     this.bindingSource.Position = e.LineNumber - 1;
 }