void PaintHexAndStringView(Graphics g, long startByte, long endByte)
{
Brush brush = new SolidBrush(GetDefaultForeColor());
Brush selBrush = new SolidBrush(_selectionForeColor);
Brush selBrushBack = new SolidBrush(_selectionBackColor);
int counter = -1;
long intern_endByte = Math.Min(_byteProvider.Length - 1, endByte + _iHexMaxHBytes);
bool isKeyInterpreterActive = _keyInterpreter == null || _keyInterpreter.GetType() == typeof(KeyInterpreter);
bool isStringKeyInterpreterActive = _keyInterpreter != null && _keyInterpreter.GetType() == typeof(StringKeyInterpreter);
for (long i = startByte; i < intern_endByte + 1; i++)
{
counter++;
Point gridPoint = GetGridBytePoint(counter);
PointF byteStringPointF = GetByteStringPointF(gridPoint);
byte b = _byteProvider.ReadByte(i);
bool isSelectedByte = i >= _bytePos && i <= (_bytePos + _selectionLength - 1) && _selectionLength != 0;
if (isSelectedByte && isKeyInterpreterActive)
{
PaintHexStringSelected(g, b, selBrush, selBrushBack, gridPoint);
}
else
{
PaintHexString(g, b, brush, gridPoint);
}
string s = new String(ByteCharConverter.ToChar(b), 1);
if (isSelectedByte && isStringKeyInterpreterActive)
{
g.FillRectangle(selBrushBack, byteStringPointF.X, byteStringPointF.Y, _charSize.Width, _charSize.Height);
g.DrawString(s, Font, selBrush, byteStringPointF, _stringFormat);
}
else
{
g.DrawString(s, Font, brush, byteStringPointF, _stringFormat);
}
}
}