-
Print a SSTab
Hello,
I have a SSTab on a form and in this SSTab I have tabs. I want to print (not the form) but the 2 tabs. The first one and after the second tab. Is it possible?? How can I do this?! I don't want to use the printForm, cause it prints all the form and I don't need that.
Thanks
-
You can do it using graphics methods. I don't remember if SSTabs have an hDC property, I doubt it. So use the form's hDC and then BitBlt the SSTab to the printer.hDC
Code:
Declare Function BitBlt Lib "gdi32" Alias "BitBlt" ( _
ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long _
) As Long
Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Dim LeftPrinterMargin as long
LeftPrinterMargin = 1200 ' margin from left side...
' 7500 twips is about halway up the printer page
' one-to-one rendering in the middle of the page, not centered
'VbSrcCopy is a VB constant for a staright copy
Call BitBlt(Printer.hDC, LeftPrinterMargin, 7500, Tab1.Width, _
Tab1.Height, GetDC(Form1.hWnd), Tab1.Left,Tab1.Top, _
VbSrcCopy)
Printer.EndDoc