473,381 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,381 software developers and data experts.

Printing Problems

I have an unmanaged C++ program that displays a printer dialog and then

asks my C# program to perform the printing operation. What printer info

do I pass to my C# program? It looks like I need to establish values in

the PrinterSettings property of a PrintDocument object. But how?
I think I should be able to use the print DC, but I don't see a way
to apply it to the PrinterSettings property.
I have tried passing the DEVMODE and DEVNAMES handles from the PRINTDLG

structure to use in the SetHdevmode() and SetHdevnames() functions -
it did not work.
Any ideas?
Thanks,
Mike

Dec 2 '05 #1
4 1516
Mike,

What you should do is call your dialog, and then have it expose the
whatever properties were set. Then, what you do is create your
PrintDocument class, and set the properties on that, along with whatever
settings in the PrinterSettings that are appropriate.

Once you do that, you call Print. Print will then call the delegate
registered with the Print event on the PrintDocument class (you need to set
that up as well). It is in there that you perform your printing, drawing to
the Graphics instance passed in through the event args. As long as your
method wrapped by the delegate has access to the parameters set in your
printer dialog, you should have everything you need.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ML****@hotmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I have an unmanaged C++ program that displays a printer dialog and then

asks my C# program to perform the printing operation. What printer info

do I pass to my C# program? It looks like I need to establish values in

the PrinterSettings property of a PrintDocument object. But how?
I think I should be able to use the print DC, but I don't see a way
to apply it to the PrinterSettings property.
I have tried passing the DEVMODE and DEVNAMES handles from the PRINTDLG

structure to use in the SetHdevmode() and SetHdevnames() functions -
it did not work.
Any ideas?
Thanks,
Mike

Dec 2 '05 #2
Thanks for the quick reply Nicholas.

Forgive me if this sounds like a stupid question, but can you expand on
what you mean by "expose whatever properties were set"? We are
using the PRINTDLG structure with the standard print dialog. Do you
mean I need to go through all the PRINTDLG, DEVMODE, and DEVNAMES items
and transfer all this information manually? (yuck)

Dec 2 '05 #3
Unfortunately, yes, that is exactly what I mean. You will have to store
that on some level, and then access it later from the delegate that handles
the actual printing (or before you start printing, depending on the
property).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ML****@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Thanks for the quick reply Nicholas.

Forgive me if this sounds like a stupid question, but can you expand on
what you mean by "expose whatever properties were set"? We are
using the PRINTDLG structure with the standard print dialog. Do you
mean I need to go through all the PRINTDLG, DEVMODE, and DEVNAMES items
and transfer all this information manually? (yuck)

Dec 2 '05 #4
Thanks for your help. I was afraid it would come to that. I was just
hoping someone would tell me there was a simpler way.

Dec 5 '05 #5

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

Similar topics

0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
5
by: Mark Preston | last post by:
Admission first - I don't actually have a problem here but have noticed that a lot of people have been asking similar questions and getting very varied answers. What I've done is to sort of...
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
1
by: G.Esmeijer | last post by:
Friends, I'm (a bit) dissapointed about the printing possibilities in c#. It could also be lack of knowedge. I would like to align a text on the right side of the paper when printing. For...
4
by: Arif | last post by:
I C# code prints very slow as compared to a third party barcode printing software. That software prints approximately 10 labels in 2 seconds while my C# code prints 10 labels in 5 to 6 seconds. And...
4
by: Tracey | last post by:
Hey folks, I have an ASP.NET web app that's working just fine, but a small percentage have two printing problems that don't happen to the vast majority of users. These problems are listed below...
1
by: Dreamtime | last post by:
Hi I am using Visual Studio 2005 and the bundled Crystal Reports (previously I used .net 2003 and bundled Crystal Reports for 2 years - same issues!) I have a report which is displayed in the...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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 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.