Printdcoument不能打印代码

时间:2017-08-01 00:44:36

标签: vb.net

我正在研究vb.net中的窗口项目。我使用了printpreview对话框和打印文档进行打印。我注意到有些时候printdocument没有生成,因为代码意味着它忽略了什么是它产生旧输出的变化。所以任何人都可以解决我的问题。

这是我的代码

  Dim y% = 10
    Dim headerf = New Font("verdana", 13, FontStyle.Bold)
    Dim normalf = New Font("verdana", 12, FontStyle.Regular)
    e.Graphics.DrawString("Rajesh Dalal", New Font("Verdana", 25, FontStyle.Regular), Brushes.Black, 290, 30)
    'Rectangle
    e.Graphics.DrawRectangle(Pens.Black, New Drawing.Rectangle(60, 100, 740, 110)) 'rectangle small 
    e.Graphics.DrawRectangle(Pens.Black, New Drawing.Rectangle(60, 230, 740, 800)) 'rectangle biggest
    'Small rectangle contents
    e.Graphics.DrawString("Shop Name : ", headerf, Brushes.Black, 80, 120)
    e.Graphics.DrawString(StrConv(lblShopName.Text, VbStrConv.ProperCase), New Font("verdana", 13, FontStyle.Regular), Brushes.Black, 220, 120)
    e.Graphics.DrawString("Duration : ", headerf, Brushes.Black, 80, 160)
    e.Graphics.DrawString(ddfrom.Value.Date.Day & "/" & ddfrom.Value.Date.Month & "/" & ddfrom.Value.Date.Year, New Font("verdana", 13, FontStyle.Regular), Brushes.Black, 220, 160)
    e.Graphics.DrawString("To", headerf, Brushes.Black, 345, 160)
    e.Graphics.DrawString(ddto.Value.Date.Day & "/" & ddto.Value.Date.Month & "/" & ddto.Value.Date.Year, New Font("verdana", 13, FontStyle.Regular), Brushes.Black, 400, 160)
    e.Graphics.DrawString(Now.Date.Day & "/" & Now.Date.Month & "/" & Now.Date.Year, New Font("verdana", 13, FontStyle.Regular), Brushes.Black, 620, 120)
    e.Graphics.DrawString("Bill Date : ", headerf, Brushes.Black, 600, 120)

1 个答案:

答案 0 :(得分:0)

打开您的项目文件夹goto debug文件夹,找到与您的项目名称匹配的exe文件,删除该文件并再次编译项目