Explicit casting :
Label label = (Label)e.FooterRow.FindControl("lblNAme");
if (label != null)
{
// Todo :
}
Type safe casting :
Label label = e.FooterRow.FindControl("lblNAme") as Label;
//'is' keyword is used in conjunction after 'as', to provide
//a more intuitive then comparing to null as in explicit casting sample
if (label is Label)
{
// Todo :
}
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
2010-05-24
2009-06-02
Watermark on PrintDocument (C#)
How to add watermark to PrintDocument
PrintDocument printDoc = new PrintDocument();
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
textControl1.PrintPreview(printDoc);
Graphics g = e.Graphics;
g.TranslateTransform(200, 200);
g.RotateTransform(e.PageSettings.Landscape ? 30 : 60);
g.DrawString("DRAFT VERSION", new Font("Arial", 20, FontStyle.Bold),
new SolidBrush(Color.FromArgb(64, Color.Black)), 0, 0);
source: http://www.textcontrol.com/downloads/library/printing/watermarks/
Labels:
C#,
Programming
Subscribe to:
Posts (Atom)