Hi,
I am setting up a orint function that prints the screen area. It is all
working except my screen area spans two print pages hwne viewed using a
print preview dialogue . I am trying to fnd a way to make the print
area fit onto a standard A4 paper print area.
Anyone any idea how I can control this and 'shrink' my current print
document?
Many Thanks
Marc
-------------------------------------------------------------------------------------------
Private Sub PrintScreenToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
PrintScreenToolStripMenuItem.Click
Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
CaptureScreen()
PrintPreviewDialog1.Document = PrintDocument1
PrintDocument1.DefaultPageSettings.Landscape = True
PrintDocument1.DefaultPageSettings.Margins.Right = 500
PrintDocument1.DefaultPageSettings.PrintableArea
PrintPreviewDialog1.ShowDialog()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
_
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles PrintDocument1.PrintPage
e.PageSettings.Margins = New
System.Drawing.Printing.Margins(250, 250, 250, 250)
Dim g As Graphics
g = e.Graphics
g.DrawImage(Background, e.MarginBounds.Left,
e.MarginBounds.Top)
g.Dispose()
e.HasMorePages = False
End Sub
Protected Sub CaptureScreen()
Dim hsdc, hmdc As Integer
Dim hbmp, hbmpold As Integer
Dim r As Integer
hsdc = CreateDC("DISPLAY", "", "", "")
hmdc = CreateCompatibleDC(hsdc)
fw = GetDeviceCaps(hsdc, 8)
fh = GetDeviceCaps(hsdc, 10)
hbmp = CreateCompatibleBitmap(hsdc, fw, fh)
hbmpold = SelectObject(hmdc, hbmp)
r = BitBlt(hmdc, 0, 0, fw, fh, hsdc, 0, 0, 13369376)
hbmp = SelectObject(hmdc, hbmpold)
r = DeleteDC(hsdc)
r = DeleteDC(hmdc)
Background = Image.FromHbitmap(New IntPtr(hbmp))
DeleteObject(hbmp)
End Sub 1 1589 http://www.vbcity.com/forums/faq.asp...orms&#TID28614
"Marc" <ma*********@hotmail.comwrote in message
news:11*********************@h40g2000cwb.googlegro ups.com...
Hi,
I am setting up a orint function that prints the screen area. It is all
working except my screen area spans two print pages hwne viewed using a
print preview dialogue . I am trying to fnd a way to make the print
area fit onto a standard A4 paper print area.
Anyone any idea how I can control this and 'shrink' my current print
document?
Many Thanks
Marc
-------------------------------------------------------------------------------------------
Private Sub PrintScreenToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
PrintScreenToolStripMenuItem.Click
Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
CaptureScreen()
PrintPreviewDialog1.Document = PrintDocument1
PrintDocument1.DefaultPageSettings.Landscape = True
PrintDocument1.DefaultPageSettings.Margins.Right = 500
PrintDocument1.DefaultPageSettings.PrintableArea
PrintPreviewDialog1.ShowDialog()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
_
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles PrintDocument1.PrintPage
e.PageSettings.Margins = New
System.Drawing.Printing.Margins(250, 250, 250, 250)
Dim g As Graphics
g = e.Graphics
g.DrawImage(Background, e.MarginBounds.Left,
e.MarginBounds.Top)
g.Dispose()
e.HasMorePages = False
End Sub
Protected Sub CaptureScreen()
Dim hsdc, hmdc As Integer
Dim hbmp, hbmpold As Integer
Dim r As Integer
hsdc = CreateDC("DISPLAY", "", "", "")
hmdc = CreateCompatibleDC(hsdc)
fw = GetDeviceCaps(hsdc, 8)
fh = GetDeviceCaps(hsdc, 10)
hbmp = CreateCompatibleBitmap(hsdc, fw, fh)
hbmpold = SelectObject(hmdc, hbmp)
r = BitBlt(hmdc, 0, 0, fw, fh, hsdc, 0, 0, 13369376)
hbmp = SelectObject(hmdc, hbmpold)
r = DeleteDC(hsdc)
r = DeleteDC(hmdc)
Background = Image.FromHbitmap(New IntPtr(hbmp))
DeleteObject(hbmp)
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Robert Kaplan |
last post by:
Hi,
I'm new to the group, so greetings all!
I'm working on an application try to respond to events in Microsoft
Access using Python and win32com. However, I'm having trouble in
setting up...
|
by: WJ |
last post by:
..Net Programmers! Please have a very Merry Christmas 2004 and a Happy New
Year !
We all work very very hard all year long, we deserve a little break and...
please click here to join the fun...
|
by: Newbie! |
last post by:
Hey Group,
I Would just like to wish you all a Marry Xmas and Say a BIG Thank You to
everyone that has helped me over the past 2 months.
Especially: Herfried K. Wagner & Cor
Many Thanks...
|
by: kudos |
last post by:
import Tkinter
import random
root = Tkinter.Tk()
w = Tkinter.Canvas(root, width=400, height=300, background="#000000")
w.create_text(200,150,text="Happy Christmas 2006",font="Arial...
|
by: kudos |
last post by:
import Tkinter
import random
root = Tkinter.Tk()
w = Tkinter.Canvas(root, width=400, height=300, background="#000000")
w.create_text(200,150,text="Happy Christmas 2006",font="Arial...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |