System.Windows.Forms.HexBox.PaintLineInfo C# (CSharp) Method

PaintLineInfo() private method

private PaintLineInfo ( Graphics g, long startByte, long endByte ) : void
g Graphics
startByte long
endByte long
return void
        void PaintLineInfo(Graphics g, long startByte, long endByte)
        {
            // Ensure endByte isn't > length of array.
            endByte = Math.Min(_byteProvider.Length-1, endByte);

            Color lineInfoColor = (this.LineInfoForeColor != Color.Empty) ? this.LineInfoForeColor : this.ForeColor;
            Brush brush = new SolidBrush(lineInfoColor);

            int maxLine = GetGridBytePoint(endByte-startByte).Y+1;

            for(int i = 0; i < maxLine; i++)
            {
                long firstLineByte = startByte + (_iHexMaxHBytes)*i;

                PointF bytePointF = GetBytePointF(new Point(0, 0+i));
                string info = firstLineByte.ToString(_hexStringFormat, System.Threading.Thread.CurrentThread.CurrentCulture);
                int nulls = 8-info.Length;
                string formattedInfo;
                if(nulls > -1)
                {
                    formattedInfo = new string('0', 8-info.Length) + info;
                }
                else
                {
                    formattedInfo = new string('~', 8);
                }

                g.DrawString(formattedInfo, Font, brush, new PointF(_recLineInfo.X, bytePointF.Y), _stringFormat);
            }
        }