Option Explicit Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Command2_Click() Load Form2 Form2.Show Dim x As Single Dim y As Single Dim h As Long h = Picture1.hWnd x = Picture1.Left y = Picture1.Top Picture1.Left = 0 Picture1.Top = 0 Form2.Height = Picture1.Height + (Form2.Height - Form2.ScaleHeight) Form2.Width = Picture1.Width + (Form2.Width - Form2.ScaleWidth) SetParent Picture1.hWnd, Form2.hWnd Form2.PrintForm SetParent h, Me.hWnd Picture1.Left = x Picture1.Top = y Form2.Hide Unload Form2 End Sub
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Command2_Click()
Load Form2
Form2.Show
Dim x As Single
Dim y As Single
Dim h As Long
h = Picture1.hWnd
x = Picture1.Left
y = Picture1.Top
Picture1.Left = 0
Picture1.Top = 0
Form2.Height = Picture1.Height + (Form2.Height - Form2.ScaleHeight)
Form2.Width = Picture1.Width + (Form2.Width - Form2.ScaleWidth)
SetParent Picture1.hWnd, Form2.hWnd
Form2.PrintForm
SetParent h, Me.hWnd
Picture1.Left = x
Picture1.Top = y
Form2.Hide
Unload Form2
End Sub
printer.paintpicture picture1.picture,60,60,450,450
printer.enddoc
用paintform的时候,picturebox中的自己做的ocx打印不出来。我的ocx是用vc做的,vb的标准控件能打得出来。还有用paintform打印的时候会出现一个提示正在打印的框,怎么把这个框去掉?
for
(假设图线保存在数组)
printer.line(x1,y1)-(x2,y2)next