Hi,
Ok I am doing a print app, what I am trying to do is get the EXACT
boundaries of the page, I want to print to the top left, 0,0, which is fine,
but bottom right is a problem.
When I use ".VisibleClipBo unds.Width" I get the correct with the first time,
for the default printer, that is set to A4.
If I select another printer from the list, it gets a bit hairy.
If the printer is not set to A4, the ".VisibleClipBo unds.Width" are wrong.
If I set the page size to A4 is still does not work, it seems to me that the
page settings are the setttings for the default selected printer, even if
you select another printer.
Here is some code:
Private Sub printBtn_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles printBtn.Click
Dim blah As New PrintDocument
blah.DocumentNa me = "mydoc.doc"
AddHandler blah.PrintPage, AddressOf PrintPage
Dim printDialog1 As New PrintDialog
printDialog1.Do cument = blah
If (printDialog1.S howDialog() = System.Windows. Forms.DialogRes ult.OK) Then
blah.PrinterSet tings = printDialog1.Pr interSettings
blah.Print()
End If
End Sub
Private Sub PrintPage(ByVal sender As Object, ByVal ev As
PrintPageEventA rgs)
Dim myWidth as single = ev.Graphics.Vis ibleClipBounds. Width
Dim myHeight as single = ev.Graphics.Vis ibleClipBounds. Height
ev.Graphics.Dra wImage(printLog oImage.Image, (myWidth -
printLogoImage. Image.Width), (myHeight - printLogoImage. Image.Height),
printLogoImage. Image.Width, printLogoImage. Image.Height)
End Sub
''''''''''''''' '
When you do this:
''''''''''''''' ''''''''''''''' ''''''''''''''' '''''''
For i As Int16 = 0 To
ev.PageSettings .PrinterSetting s.PaperSizes.Co unt - 1
If ev.PageSettings .PrinterSetting s.PaperSizes(i) .Kind =
PaperKind.A4 Then
ev.PageSettings .PaperSize =
ev.PageSettings .PrinterSetting s.PaperSizes(i)
Exit For
End If
Next
it does not update "VisibleClipBou nds"
Any suggestions???
Thankyou
Joshua 1 1944
* "Joshua Anderson" <jo**@mastermin d.net.au> scripsit: Ok I am doing a print app, what I am trying to do is get the EXACT boundaries of the page, I want to print to the top left, 0,0, which is fine, but bottom right is a problem.
When I use ".VisibleClipBo unds.Width" I get the correct with the first time, for the default printer, that is set to A4.
If I select another printer from the list, it gets a bit hairy. If the printer is not set to A4, the ".VisibleClipBo unds.Width" are wrong.
If I set the page size to A4 is still does not work, it seems to me that the page settings are the setttings for the default selected printer, even if you select another printer.
Maybe you want to determine phys. margins:
<http://www.google.com/groups?selm=uLE 8v9%23iDHA.2328 %40TK2MSFTNGP12 .phx.gbl>
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
<http://www.plig.net/nnq/nquote.html> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jody Gelowitz |
last post by:
I am having a problem with printing selected pages. Actually, the problem
isn't with printing selected pages as it is more to do with having blank
pages print for those pages that have not been selected.
For example, if I were to have 5 pages with every second page printing, I
would get the following results:
Page 1 = Print OK
Page 2 = Blank
Page 3 = Print OK
Page 4 = Blank
|
by: gb |
last post by:
Hi All,
Ive created a popup page using 'var openWindow = window.open("new","pop")'
And added content using openWindow.document.write(" "); statements. But now
I would like to be able to print this page?
openWindow.document.write("<a href='#'
onClick='self.close()'>Close<\/a><\/p>")
|
by: anders |
last post by:
Hi!
I have a panel formed as an A4-page, in this panel I have som labels,
pictureboxes and a datagrid. How can I print the complete panel vith all it's
controls?
Regards
Anders Aleborg
|
by: Dan Bass |
last post by:
I've got a custom control that makes use of DrawString and DrawBezier, drawn
from the graphics object passed by in the PaintEventArgs for the Paint
event.
I've not printed anything via c# before, but would it be easy to draw on a
PrintDocument the same way I currently am on the control?
Where should I start?
Anything thing to watch for would be the fact the control could grow quite
long (while I can keep the width fixed to the current...
|
by: Gidi |
last post by:
Hi,
I've created a form that prints a document which i created (with the
printDocument class), I draw the page's lines and text. when i'm printing it
on my computer, with my printer, the printing is ok, the page boundes are ok.
but when i take my project *.exe file to a computer which have only .NET
framework (and don't have visual studio), the printing bounds are different.
The OS is same on both computers, the printers are different....
| |
by: randy1200 |
last post by:
I'm using Visual Studio 2005 and C#. I need to print a WinForm used for data
entry as a graphic. In other words, I need to print the exact WinForm the
user sees on the screen.
I searched through the newsgroups, and found the code below. This seems
reasonable, except for the fact that the author does not provide his
SetSeq_Library. This is needed to load the Bitmap variable _ActiveFormImage.
Any suggestions on how to capture a WinForm...
|
by: Richard MSL |
last post by:
I have an application that prints documents that it creates. It uses what I
believe is a standard .NET way of doing so, like this:
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
PrintDialog PrintDialog1 = new PrintDialog();
PrintDialog1.Document = pd;
DialogResult result = PrintDialog1.ShowDialog();
|
by: deepakfordotnet |
last post by:
Hi,
First of all let me confess that I could not get the solution to the same problem from an earlier post Printing :by Mr.Richard MSL (dated September 24th 2006) working.
(Replied by Mr.Walter Wang - September 27th 2006)
My problem is to Print a text from a RichTextBox with all options like - AllowMultiplePages enabled plus PrintPreview and PageSetup.
I tried 2 algorithms - 1 posted in Microsoft and 1 posted in this forum.
...
|
by: mehdi |
last post by:
Hi,
Consider a printing scenario where I have to draw the entire page on a
827x1169 (.01 inch) size. Thereafter, the entire bitmap has to be
resized to fill a given Bounds rectangle (keeping the aspect ratio
fixed). To do so, I've just wrote the following code in the PrintPage
event:
Graphics g = e.Graphics;
Rectangle bounds = TheDestinationRectangle;
Rectangle rc = new Rectangle(0, 0, (Int32)(827 * g.DpiX / 100), (Int32)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |