After I posted this I noticed that was missing from my code in this post. I guess must be some kind of code this web page uses. But, where you see a blank spot just put in there in your mind.
This is a very simple text printing code but when I get to the page setup dialog where I can adjust the margins and press print I get a fatal error for some reason on win98 but it prints perfecly on xp pro and I cannot see any reason why.
Does anyone know what may be the cause?
Code:
private void PrintMenuItem_Click(object sender, System.EventArgs e)
{
this.pageSetupDialog.ShowDialog();
DialogResult r= this.printDialog.ShowDialog();
if(r==DialogResult.OK)
{
DialogResult R= this.PrintPre.ShowDialog();
if(R==DialogResult.OK)
this.printDocument.Print();
}
}
//--------------------------------------------------------------
int =0;
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int charsFilled=0, linesFilled=0;
string text= this.RTB.Text.Substring( , RTB.Text.Length- );
e.Graphics.MeasureString(text,
this.RTB.Font, new SizeF(e.MarginBounds.Width, e.MarginBounds.Height),
new StringFormat(StringFormatFlags.LineLimit), out charsFilled, out linesFilled);
e.Graphics.DrawString(text, this.RTB.Font, Brushes.Red, e.MarginBounds, new StringFormat(StringFormatFlags.LineLimit) );
= +charsFilled;
if( < this.RTB.Text.Length) { ++ ; e.HasMorePages=true; }
else {e.HasMorePages=false; =0;}
}
This is a very simple text printing code but when I get to the page setup dialog where I can adjust the margins and press print I get a fatal error for some reason on win98 but it prints perfecly on xp pro and I cannot see any reason why.
Does anyone know what may be the cause?