OK in my notepad like program, I want to print the text like code so I want the reserved words to be printed in blue and the text to be within the margins any ideas how to do this??
This is what i have so far.
int charPag = 0;
int linPag = 0;
Font rodFont = new Font("Courier New", (float)10.0);
e.Graphics.MeasureString(stringToPrint, txtMain.Font, e.MarginBounds.Size, StringFormat.GenericTypographic, out charPag, out linPag);
e.Graphics.DrawString(stringToPrint, txtMain.Font, new SolidBrush(Color.Black), e.MarginBounds, StringFormat.GenericTypographic);
stringToPrint = stringToPrint.Substring(charPag);
e.Graphics.DrawLine(Pens.Black, e.MarginBounds.Left, e.MarginBounds.Bottom, e.MarginBounds.Right, e.MarginBounds.Bottom);
e.Graphics.DrawString(numPag.ToString(), rodFont, Brushes.Black, e.MarginBounds.Right - (numPag.ToString().Length * rodFont.SizeInPoints), e.MarginBounds.Bottom + 5);
if (stringToPrint.Length > 0)
{
e.HasMorePages = true;
numPag++;
}
Create a HashSet holding the reserved words
Then you will have to find the identifiers contained in a text line. Identifiers are character sequences beginning with a letter or an underscore and consisting of letters, underscores and digits.
Once you have found an identifier, check whether it is a reserved keyword or not