System.Windows.Forms.HexBox.StringKeyInterpreter.PreProcessWmChar C# (CSharp) Méthode

PreProcessWmChar() public méthode

public PreProcessWmChar ( Message &m ) : bool
m Message
Résultat bool
            public override bool PreProcessWmChar(ref Message m)
            {
                if(Control.ModifierKeys == Keys.Control)
                {
                    return _hexBox.BasePreProcessMessage(ref m);
                }

                bool sw = _hexBox._byteProvider.SupportsWriteByte();
                bool si = _hexBox._byteProvider.SupportsInsertBytes();
                bool sd = _hexBox._byteProvider.SupportsDeleteBytes();

                long pos = _hexBox._bytePos;
                long sel = _hexBox._selectionLength;
                int cp = _hexBox._byteCharacterPos;

                if(
                    (!sw && pos != _hexBox._byteProvider.Length) ||
                    (!si && pos == _hexBox._byteProvider.Length))
                {
                    return _hexBox.BasePreProcessMessage(ref m);
                }

                char c = (char)m.WParam.ToInt32();

                if(RaiseKeyPress(c))
                    return true;

                if(_hexBox.ReadOnly)
                    return true;

                bool isInsertMode = (pos == _hexBox._byteProvider.Length);

                // do insert when insertActive = true
                if(!isInsertMode && si && _hexBox._insertActive)
                    isInsertMode = true;

                if(sd && si && sel > 0)
                {
                    _hexBox._byteProvider.DeleteBytes(pos, sel);
                    isInsertMode = true;
                    cp = 0;
                    _hexBox.SetPosition(pos, cp);
                }

                _hexBox.ReleaseSelection();

                if(isInsertMode)
                    _hexBox._byteProvider.InsertBytes(pos, new byte[]{(byte)c});
                else
                    _hexBox._byteProvider.WriteByte(pos, (byte)c);

                PerformPosMoveRightByte();
                _hexBox.Invalidate();

                return true;
            }