Exemplo n.º 1
0
            /// <summary>
            /// Updates the mouse selection.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
            private void UpdateMouseSelection(object sender, MouseEventArgs e)
            {
                if (!mouseDown)
                {
                    return;
                }

                currentPositionInfo = GetBytePositionInfo(new Point(e.X, e.Y));
                long selEnd = currentPositionInfo.Index;
                long realselStart;
                long realselLength;

                if (selEnd < startPositionInfo.Index)
                {
                    realselStart  = selEnd;
                    realselLength = startPositionInfo.Index - selEnd;
                }
                else if (selEnd > startPositionInfo.Index)
                {
                    realselStart  = startPositionInfo.Index;
                    realselLength = selEnd - realselStart;
                }
                else
                {
                    realselStart  = HexViewer.bytePosition;
                    realselLength = 0;
                }

                if (realselStart != HexViewer.bytePosition || realselLength != HexViewer._selectionLength)
                {
                    HexViewer.InternalSelect(realselStart, realselLength);
                }
            }