void ByteValueChanged(MixByteTextBox textBox, MixByteTextBox.ValueChangedEventArgs args) { var oldValue = new Word(mWord.Magnitude, mWord.Sign); mWord[textBox.Index] = args.NewValue; mLastRenderedMagnitude = mWord.MagnitudeLongValue; mLastRenderedSign = mWord.Sign; var newValue = new Word(mWord.Magnitude, mWord.Sign); OnValueChanged(new WordEditorValueChangedEventArgs(oldValue, newValue)); }
void InitializeComponent() { mFocusByte = 0; mFocusByteSelStart = 0; mFocusByteSelLength = 0; int tabIndex = 0; int width = 0; SuspendLayout(); if (IncludeSign) { Controls.Add(mSignButton); tabIndex++; width += mSignButton.Width - 1; } mByteTextBoxes = new MixByteTextBox[ByteCount]; for (int i = 0; i < ByteCount; i++) { var box = new MixByteTextBox(i) { Location = new Point(width, 0), Name = "MixByteEditor" + i, MixByteValue = mWord[i], ReadOnly = ReadOnly, TabIndex = tabIndex }; box.ValueChanged += ByteValueChanged; box.Click += Editor_Click; box.Leave += Editor_Leave; box.KeyPress += Editor_KeyPress; box.KeyDown += This_KeyDown; mByteTextBoxes[i] = box; Controls.Add(box); tabIndex++; width += box.Width - 1; } Name = "WordEditor"; Size = new Size(width + 1, 21); ResumeLayout(false); Update(); }