473,800 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple printing app

Hi, Could anyone help with the following.

I have a windows form. On it I have a function (DrawCross) to draw a
cross throught the centre of the form from corner to corner. The
function which draws the cross takes as input a graphics object, a
width and a height.

So on paint I call the function with the width and height set to the
forms client width and height. The upshot being that as I resize the
form so the cross is drawn through the centre of the form from the
corners. Resize the form big means a big cross, resize small means
small cross. Simple.

Now I want to print the cross. I implement the PrintDocument control in
the usual way. On the PrintDocuments' PrintPage event handler I call
the forms' DrawCross method and pass the PrintPageEventA rgs' e.Graphics
object and the width and height of the form.

Now it all works fine. I get the print preview image. But as you will
see, the image size is the SAME as the form size. So if the form is
sized small, the print preview will consist of a white page with the
cross at the top left. If the form is sized big, the preview will be of
part of the cross - it won't fit on the page.

How can I get the cross to fill the page exactly. I thought it would be
as easy as passing
pgSettings.Boun ds.Width and pgSettings.Boun ds.Height as the width and
height to DrawCross. But it doesn't quite work. If I do this, the cross
is of exactly the right size but the print preview window is cropping
the image of the cross in a way related to the size of the form.

Basically what form shows, I want to fill paper with. Can I do it?

Thanks for any help.
Mitch.

Mar 23 '06 #1
1 1521
No worries. SOLVED. Found my error.

Mitch.

Mar 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1717
by: nephish | last post by:
Hey there, i have been spending some time learning python. i do enjoy it so. Heres the deal. i need some dirrection advice. i have a friend that wants me to set up a customer database for him. Easy stuff like name, phone number, email address. and current status. he also wants to be able to print this stuff out. Heres the deal. He runs windows xp. how could i write something to help him out ? i thought of glade, since its gtk and gtk can...
2
1572
by: Jack Russell | last post by:
Gee vb.net makes me feel dumb! My understanding is that I set up and do all of my printing in the printdocument printpage and handler using various graphics methods such as drawstring. Is that correct? If so how do I force a form feed?
1
1005
by: Paul Fredlein | last post by:
Hi, Is there a simple way to print the contents of a multi line edit field? Just unformatted text with CRLF. Thanks, Paul
4
7374
by: Noozer | last post by:
Can someone provide a simple example of how to print using VB.Net??? Basically just looking for a "HELLO WORLD" example to the printer. I'll worry about formatting, etc. later on. Right now I have a single string that could be a few thousand characters long and I want to print it to the printer and eject the page. Thx!
3
404
by: adam | last post by:
Is there not a way to do a simple print like in vb6? Printer.Print All I want to do is put a could of text lines on a page.
6
9428
by: sathyashrayan | last post by:
Dear group, Following is a exercise from a book called "Oreilly's practical C programming". I just wanted to do a couple of C programming exercise. I do have K and R book, but let me try some simple one. Exercise 4-2: Write a program to print a block E using asterisks (*), where the E has a height of seven characters
6
3246
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument (much like the current model), but my PrintDocument would have a Pages collection such that each time you need to have an additional page, you would just add another page to the collection and then use the page object for the actual drawing etc. ...
3
1617
by: Milan Todorovic | last post by:
Hello, I need help with something that should be pretty trivial, but I can't seem to find an easy way to do it. I have a printing routine set up in a windows vb.net 2005 app. The routine has all the printing settings defined, so no PrintDialog is needed. However, when printing starts, the application displays a print notification window while buffering information. Granted, it's there for only a second or so, but I need this window...
1
2418
by: epilogue | last post by:
Hey guys Im pretty new to Java and while I am finding it enjoyable i am getting several errors!!! Do you think you could help me on this particular question of an Assignment im doing. I have to make a simple program that takes 10 sets of numbers from a text file which it reads the Length, Width and Height from. Then the program works out the Surface Area, Volume and the Postage. The Surface Area, Volume and Postage sections work fine but the...
3
1773
by: Astan Chee | last post by:
Hi, Im looking for a python module to do simple chemistry things. Things like, finding the name of elements given the atomic number (and vice versa); what state the given matter is in depending on certain parameters; maybe even color of certain elements or even calculating the result of combining certain elements. I was looking for something simple, but everything I see seems to be a full blown chemistry set. I know I can probably spend...
0
9691
marktang
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...
0
10505
Oralloy
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...
0
10276
jinu1996
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...
1
10253
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,...
0
10035
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.