Note that there are some explanatory texts on larger screens.

plurals
  1. POc# graphics creation
    primarykey
    data
    text
    <p>I have some code that is used to programmatically create a Document to send to the printer. It goes something like this:</p> <pre><code>private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs ev) { ev.Graphics.DrawImage(pictureBox1.Image, 50, 100); string drawToday="Date : "+strToday; string drawPolicyNo="Policy # : " + strPolicyNo; string drawUser="User : " + strUser; Font drawFont=new Font("Arial",30); SolidBrush drawBrush=new SolidBrush(Color.Black); PointF drawPointToday=new Point(50,400); PointF drawPointPolicyNo=new Point(50,450); PointF drawPointUser=new Point(50,500); ev.Graphics.DrawString(drawToday,drawFont,drawBrush,drawPointToday); ev.Graphics.DrawString(drawPolicyNo,drawFont,drawBrush,drawPointPolicyNo); ev.Graphics.DrawString(drawUser,drawFont,drawBrush,drawPointUser); } </code></pre> <p>Its effective code, but now I need to do the same procedure but instead write it to an image file so that it can be sent to a browser and printed from there. It should be relatively simple to reuse this code, but I am getting hung up, unfortunately, on what drawing surface to use in replacement of the PrintPageEventArgument. </p> <p>Thanks</p> <p><strong>Edit</strong>: THanks I get that I just need another Graphics object, but the Graphics object by itself does not have a public constructor, so what I am looking for is a suggestion on what object I need to substatiate to be able to create a Graphics object to draw on. I thought perhaps bitmap? Bitmaps are of course pixel based instead of point based so I was not sure that this is the best medium to use.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload