回复 26# userlong
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
DIM $Form1
$cgspb_1 = GUICreate("单据", 1267, 713, 279, 130)
$cgyj_Button1 = GUICtrlCreateButton("提交", 112, 288, 75, 25)
GUICtrlSetOnEvent($cgyj_Button1, "kc")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
IF $nMsg[1]=$Form1 THEN
GUIDelete($Form1)
Else
EXIT
EndIf
Case $cgyj_Button1
kc()
EndSwitch
WEnd
Func kc()
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("打印预览", 601, 701)
$op = ObjCreate("VSPrinter8.VSPrinter.1")
$oh = GUICtrlCreateObj($op, 0, 0, 600, 700)
GUISetState(@SW_SHOW,$Form1)
With $op
; .preview = True;打印预览
.DocName = "打印"
.MarginLeft = 1000;左边距
.MarginRight = 1000;右边距
.MarginTop = 1000;上边距
.MarginBottom = 1000;下边距
.PaperSize = 9;页面大小 A4
.Orientation = 0;页面方向。横向,纵向
.StartDoc;页面开始
.SpaceAfter = 400;段落间距
.TextAlign = 0;文字对齐 0:靠左;1:居中;2:靠右
.FontName = "黑体";字体
.FontBold = True;字体加粗
.FontSize = 30;字号
.Paragraph = "标题";文字
.FontSize = 16
.Paragraph = "是好似好似好似hi实施时候死时候好似hi时尚" & _
"减肥的理解的是离开房间时看到附件里看的是解放路口的时间弗兰克"
.Paragraph = "Right now the margins are set as follows:"
.SpaceAfter = 0;段落间距
.AddTable("3000|1000", "项目|值", _
"左边距|" & Int(.MarginLeft) & ";" & _
"上边距|" & Int(.MarginTop) & ";" & _
"右边距|" & Int(.MarginRight) & ";" & _
"下边距|" & Int(.MarginBottom) & ";", 0xffffff)
.AddTable("3000|1000|1000", "项目|值", _
"左边距|" & Int(.MarginLeft) & ";" & _
"上边距|" & Int(.MarginTop) & ";" & _
"右边距|" & Int(.MarginRight) & ";" & _
"下边距|" & Int(.MarginBottom) & ";", 0xffffff)
.PenColor = 0x000000;画笔颜色,黑色
.BrushColor = 0xffffff;刷子颜色,白色
.PenStyle = 6
.PenWidth = 10;画笔宽度
.DrawLine(4000, 0, 4000, 17000);划线
.DrawLine(8000, 0, 8000, 18000);划线
.DrawLine(0, 4250, 12000, 4250);划线
.DrawLine(0, 8500, 12000, 8500);划线
.DrawLine(0, 12750, 12000, 12750);划线
.DrawCircle(3000,3000,200);画圆
.FontSize = 12
.Paragraph = "单位: 元"
.EndDoc;页面结束
EndWith
EndFunc
|