vb.net 套打的问题?急..

[复制链接]
查看11 | 回复3 | 2021-1-27 06:48:25 | 显示全部楼层 |阅读模式
RT。我现在用的是比较笨的方法.就是调用graphics下面的drawstring方法,带孔的四连纸,实际距离我都量好了。在代码中用到
e.Graphics.PageUnit=GraphicsUnit.Millimeter
但是总是不是很准确,我想有些能够做到纸的方格中居中显示,但是字符的多少又不是确定,都是从数据库读出来。有没有什么办法让字符正好在单子方格中居中显示。还有看到网上好多的例子都是用像素来定位,但是怎么转换,请大家帮帮忙。谢谢
PrivatenintAsShort=4.52'1毫米距离内的像素点
PrivateSubPrintLeftStr(ByValPstrAsString,ByValPfontAsFont,ByValnxAsSingle,ByValnyAsSingle,ByValeAsPrintPageEventArgs)
e.Graphics.PageUnit=GraphicsUnit.Millimeter
nx=nx*nint:ny=ny*nint+16*nint
e.Graphics.DrawString(Pstr,Pfont,Brushes.Black,nx,ny)
EndSub
PrintStr=DataGridView1.CurrentRow.Cells("姓名").Value
PrintLeftStr(PrintStr,CtFont,34,8,ev)
PrintStr=DataGridView1.CurrentRow.Cells("电话").Value
PrintLeftStr(PrintStr,CtFont,34,16,ev)
PrintStr=DataGridView1.CurrentRow.Cells("姓名").Value
PrintLeftStr(PrintStr,CtFont,113,8,ev)
PrintStr=DataGridView1.CurrentRow.Cells("电话").Value
PrintLeftStr(PrintStr,CtFont,113,16,ev)
部分代码如上
分 -->
回复

使用道具 举报

千问 | 2021-1-27 06:48:25 | 显示全部楼层
套打还是用报表控件吧,有很多免费的,也有收费的
水晶报表也不错
回复

使用道具 举报

千问 | 2021-1-27 06:48:25 | 显示全部楼层
很多報表控件啊
回复

使用道具 举报

千问 | 2021-1-27 06:48:25 | 显示全部楼层
1mm=3.937像素
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行