Hur skriver man ut t.ex. Form2 så det fyller Hittade fäljande :utSkrift i vb
hela A4 arket
samt skriver ut Bilder & allt man har med i Form2 rent
visuellt på enklast möjliga sättSv: utSkrift i vb
<code>
' Prntform sample from BlackBeltVB.com
' http://blackbeltvb.com
'
' Written by Matt Hart
' Copyright 1999 by Matt Hart
'
' This software is FREEWARE. You may use it as you see fit for
' your own projects but you may not re-sell the original or the
' source code. Do not copy this sample to a collection, such as
' a CD-ROM archive. You may link directly to the original sample
' using "http://blackbeltvb.com/prntform.htm"
'
' No warranty express or implied, is given as to the use of this
' program. Use at your own risk.
'
' This sample utilizes a better method than "PrintForm" to print the contents of
' a Form. PrintForm sometimes excludes grid and other controls. This method simulates
' pressing the PrintScrn key, which copies the image of either the form or screen to
' the clipboard. Note that I call the .Clear method of the Clipboard first - that's because
' it might already have text or something on it.
'
' When printing, note that I scale the picture's height to proportionally fit the
' printer's resolution. The procedure would need to be adjusted if the Height of the
' Form/Screen was greater than Printer.ScaleHeight, or if the Height was greater than
' the Width and the Width was greater than Printer.ScaleWidth.
'
' Updated with VK_MENU keypresses - note that NT needs these.
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_MENU As Byte = &H12
Private Const VK_SNAPSHOT As Byte = &H2C
Private Const KEYEVENTF_KEYUP = &H2
Private Sub cmdPrintForm_Click()
Dim lWidth As Long, lHeight As Long
Clipboard.Clear
Call keybd_event(VK_MENU, 0, 0, 0)
Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
DoEvents
Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)
Call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0)
Printer.Print
If Width > Printer.ScaleWidth Then
lWidth = Printer.ScaleWidth
lHeight = (Printer.ScaleWidth / Width) * Height
Else
lWidth = Width
lHeight = Height
End If
Printer.PaintPicture Clipboard.GetData, 0, 0, lWidth, lHeight
Printer.EndDoc
End Sub
</code>
ok testa och se, med lite enkla ändringar så kan du ju få centrerad och den storlek du vill.