各位大神,小弟初来乍到,对编程不怎么懂,望各位大神不吝赐教。
小弟在公安系统工作,因文书写作实在麻烦,同样的信息每次得写四遍,烦不胜烦。望大神帮忙写一段VB代码,方便完成打印文书。
窗体设计如下:
窗体1窗体2想让窗体1文本框中的所输入的内容,按预览按钮后,在窗体2的横线上相应的显示出来。然后再按打印按钮,将窗体2所显示的内容以A4纸张大小打印出来。
1、红框中的日期能自动生成。
2、红框中的编号能自动生成,依次递增。
望大神不吝赐教,万分感谢!
小弟在公安系统工作,因文书写作实在麻烦,同样的信息每次得写四遍,烦不胜烦。望大神帮忙写一段VB代码,方便完成打印文书。
窗体设计如下:
窗体1窗体2想让窗体1文本框中的所输入的内容,按预览按钮后,在窗体2的横线上相应的显示出来。然后再按打印按钮,将窗体2所显示的内容以A4纸张大小打印出来。
1、红框中的日期能自动生成。
2、红框中的编号能自动生成,依次递增。
望大神不吝赐教,万分感谢!
Dim Y as Integer
Dim M as Integer
Dim D as Integer
Dim No as Long
d=Now
Y=Year(d)
M=Month(d)
D=Day(d)
f=FreeFile()
Open "No.txt" for input as #f
Input #f,No
Close #f
No=No+1
Open "No.txt" for output as #f
Print #f,No
Close #f
CurrentX, CurrentY Properties
Applies To See AlsoSpecifies the horizontal (X) and vertical (Y) coordinates for the next drawing method. Not available at design time; read-write at run time.SyntaxObject.CurrentX[ = nXCoord]Object.CurrentY[ = nYCoord]SettingsnXCoordSpecifies the horizontal coordinate of the form, in the unit of measurement specified by the ScaleMode property of the form.nYCoordSpecifies the vertical coordinate of the form, in the unit of measurement specified by the ScaleMode property of the form.ResCoordinates are measured from the upper-left corner of an object. CurrentX is 0 at an object's left edge and CurrentY is 0 at its top edge. Coordinates are expressed in foxels or the current unit of measurement defined by the ScaleMode property.When you use the following graphics methods, the CurrentX and CurrentY settings are changed as indicated.Method CurrentX, CurrentY set to
Box The endpoint of the box as specified by the last two arguments.
Circle The center of the object.
Cls 0, 0.
Line The endpoint of the line.
Print The next print position.
Pset The point drawn.
FontSize 属性
返回或设置在控件中或在运行时画图或打印操作中,显示文本所用的字体的大小。注意 包含 FontSize 属性是为了和 CommonDialog 控件一起使用,以及与以前的 Visual Basic 版本兼容。对于其它的功能,请使用新的 Font 对象属性(对 CommonDialog 控件不可用)。语法object.FontSize [= points]FontSize 属性语法包含下面部分:部分 描述
object 对象表达式,其值是“应用于”列表中的一个对象。
points 数值表达式,用磅为单位指定所用字体的大小。
说明用该属性以所要的字体格式化文本。缺省值由系统决定。要改变缺省值,以磅为单位指定字体尺寸。FontSize 的最大值为 2160 磅。注意 Visual Basic 中可用的字体取决于系统的配置、显示设备和打印设备。与字体相关的属性只能设置为真正存在的字体的值。一般来说,用 FontSize、FontBold、FontItalic、FontStrikethru 和 FontUnderline 属性来设置大小和样式属性前,应该先改变 FontName 属性。然而,在设置 TrueType 字体尺寸小于 8 磅时,应用 FontSize 属性来设置字体大小,然后设置 FontName 属性,用 FontSize 属性再一次设置字体大小。Microsoft Windows 运行环境对于小于 8 磅的 TrueType 字体使用不同的字体。
http://download.csdn.net/download/vbtoy/10050623