答案 0 :(得分:1)
这是一个简单的样本..
Dim pd as New PrintDocument
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
pd.Print()
End Sub
Private Sub pd_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pd.PrintPage
e.Graphics.DrawString(TextBox.Text, TextBox1.Font, Brushes.Black, 100, 100)
e.Graphics.DrawImage(PictureBox1.Image, 200, 200) '----> imagein picture box
End Sub
增加:
以文字为中心
Dim x as Single = Convert.ToSingle(e.PageBounds.Width / 2 - e.Graphics.MeasureString(TextBox.Text, TextBox1.Font).Width / 2)
e.Graphics.DrawString(TextBox.Text, TextBox1.Font, Brushes.Black, x, 100)