Open-source: vs. Net printing page settings (pagesetupdialog) always change the value, customize the paper and continuous paper routing problems and solve the source code (2)

Source: Internet
Author: User
Open-source: vs. Net printing page settings (pagesetupdialog) always change the value, customize the paper and continuous paper routing problems and solve the source code (2)
Sorting: Yangtze River Tributary

Key words: vs. net, printing, page Setting dialog box, custom paper, continuous paper
Date: 2006-02-09

Abstr

There are a lot of questions about how to change the settings of printing pages, custom paper, and continuous paper. There are many sayings, some of which are vs. Net bugs, some of which must use APIs, and others...
In fact, we have not thoroughly studied it. Here are some solutions.

In the previous article, when pagesetupdialog is used to print the page setting value, each time the dialog box is displayed, the page margin is entered. The next time you enter the page Setting dialog box, you will find a solution to change the original value.

In this article, we will work together to solve the problem of Custom paper, so that we can implement custom paper and continuous paper without using APIs.

This is an issue that everyone is particularly concerned about. On csdn, many netizens often ask these questions that have not been well solved, so that they say that they are vs.net bugs and some other misunderstandings. The following uses the practices of netizens to give the answer. I have long wanted to write it out, however, I did not write some comments to my blog in time, but replied in the Forum. Now, I still put it on my blog. Otherwise I am sorry for these enthusiastic netizens who want to let more people know the answer. I am afraid of what others will say :)

An enthusiastic netizen sent a letter and a solution:
-----------------------------------------------------
Hello, Brother Zhou,
 
I asked you a question about continuous paper printing a few days ago. Now it has been solved. Although the method is not very good, it is simple and effective. I recorded it in my network log.
 
Http://spaces.msn.com/members/vdonkey/
 
I wanted to send a message online, but most of the related posts have been closed. That's why I sent it to you to help others. If someone asks you for help, please refer to it.
 
Thank you again for your help.

 

Another enthusiastic Netizen's letter and solution:

(Original post)

Http://community.csdn.net/Expert/topic/4318/4318195.xml? Temp =. 8120691.
-----------------------------------------------------

=== The second 100 question: too much paper is taken by the dot matrix printer. How can this problem be solved? ====
Thank you, flygoldfish, your program printpagesetup.
I am inspired to solve the problem and share it with you:
When printdocument is defined, the definition of paper conflicts, that is:
Defining the paper in printdocument can simulate that the display is correct, but in the print
Always follow the A4 paper, and disable the printing settings.
So, you 'd better use the print settings when printing, like flygoldfish (Yangtze River Tributary)
It is best to encapsulate it in printsettings. Example:
Prtmyprintdocument Pd = new prtmyprintdocument (my); // assume it is the default printer
PD. defaultpagesettings = This. prtsetup (PD );
Printpreviewdialog DLG = new printpreviewdialog ();
DLG. Document = Pd;
Dialogresult result = DLG. showdialog ();
If (result = dialogresult. OK)
{
PD. Print ();
}
Prtmyprintdocument is the printdocument inheritance class defined by myself.
The paper is defined, so the paper cannot be taken correctly. Now it is normal.
This. prtsetup (PD) method is very simple. Refer to the code of flygoldfish (Yangtze River Tributary) as follows:
Private pagesetaskprtsetup (printdocument)
{
// Declare the pagesettings of the returned value
Pagesettings PS = new pagesettings ();
// Declare and instantiate pagesetupdialog
Pagesetupdialog psdlg = new pagesetupdialog ();
Try
{
// Related documents and documents page default settings
Psdlg. Document = printdocument;
Psdlg. pagesettings = printdocument. defaultpagesettings;
// Display dialog box
Dialogresult result = psdlg. showdialog ();
If (result = dialogresult. OK)
{
PS = psdlg. pagesettings;
Printdocument. defaultpagesettings = psdlg. pagesettings;
}
}
Catch (exception ex)
{
MessageBox. Show (ex. tostring (), "print error ");
}
Finally
{
Psdlg. Dispose ();
Psdlg = NULL;
}
Return pS;
}
You can define other parameters of your own. Thank you again for your reference )!
I hope the above will be useful to you.

------------------------------------------------------------------------------

So far, we have provided a solution to the problem of changing the pagesetupdialog value, custom paper, and continuous paper walking, hoping to give you some inspiration.

Thanks again to enthusiastic netizens, especially the two friends above.

Access my blog on csdn:
Http://blog.csdn.net/flygoldfish

Disclaimer: This article is copyrighted by Zhou fangyong. If you need to reprint it, please keep the complete content and source.

 

Related Resources:

Use pagesetupdialog to print the page. The setting value always changes. View

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.