Are you asking how to "print" to the print preview?
The simplest solution is to implement fixed position printing and
implement an IDraw interface. Extend the textbox control and add an
IDraw Draw method. At print preview create an array of IDraw objects and
iterate over the array calling Draw on each IDraw object. Each IDraw
object knows its position and prints itself.
http://www.geocities.com/jeff_louie/OOP/oop21.htm
So for a textbox you have a method as:
public bool Draw(IPrintEngine pe,
float xPos,
float yPos,
Graphics g,
RectangleF pageRect,
bool isSimulation)
{
Brush brush;
Font font;
StringFormat stringFormat;
if (this.isUseDocumentProperties)
{
brush= pe.Brush;
font= pe.Font;
stringFormat= pe.StringFormat;
stringFormat.SetTabStops(0.0f,pe.TabStops);
}
else
{
brush= new SolidBrush(this.ForeColor);
font= this.Font;
stringFormat= this.stringFormat;
stringFormat.SetTabStops(0.0f,pe.TabStops);
}
string text= this.Text;
if (this.isReplaceTokens)
{
text= pe.ReplaceTokens(text);
}
text= text.Trim();
if (!this.Multiline)
{
if (!isSimulation)
{
g.DrawString(text,
font,
brush,
new RectangleF(xPos+this.horizontalMargin,
yPos+this.verticalMargin,
(this.CalculateWidth(pe,g)-(this.horizontalMargin*2)),
this.Size.Height),
this.stringFormat);
}
}
else
{
if (!isSimulation)
{
g.DrawString(text,
font,
brush,
new RectangleF(xPos+this.horizontalMargin,
yPos+this.verticalMargin,
this.Size.Width,
this.Size.Height),
this.stringFormat);
}
}
return false;
}
If you are asking about the actual print dialog control, I plead
ignorance :).
Regards,
Jeff
*** Sent via Developersdex
http://www.developersdex.com ***