BytePositionInfo GetHexBytePositionInfo(Point p)
{
//System.Diagnostics.Debug.WriteLine("GetHexBytePositionInfo()", "HexBox");
long bytePos;
int byteCharaterPos;
float x = (p.X - _recHex.X) / _charSize.Width;
float y = (p.Y - _recHex.Y) / _charSize.Height;
int iX = (int)x;
int iY = (int)y;
int hPos = (iX / 3 + 1);
bytePos = Math.Min(_byteProvider.Length,
_startByte + (_iHexMaxHBytes * (iY + 1) - _iHexMaxHBytes) + hPos - 1);
byteCharaterPos = (iX % 3);
if (byteCharaterPos > 1)
byteCharaterPos = 1;
if (bytePos == _byteProvider.Length)
byteCharaterPos = 0;
if (bytePos < 0)
return new BytePositionInfo(0, 0);
return new BytePositionInfo(bytePos, byteCharaterPos);
}