473,756 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printer object replacement syntax

We currently are trying our first transformation from VB6 to VB.Net. Of
course, the Printer object is gone, but I'm having trouble finding the
replacement syntax necessary to perform similar actions or set variables.
We are interested in doing this inline (no pop-up dialog box).
Specifically, where how would I replace the following properties/methods of
the old Printer objects.

Printer.NewPage
Printer.TextHei ght
Printer.TextWid th
Printer.PaintPi cture
Printer.Print
Printer.Line
Printer.EndDoc

Thanks, Tom.

Jul 21 '05 #1
5 2027
"Tom Berry" <tb***@planetes hop.com> schrieb
We currently are trying our first transformation from VB6 to VB.Net.
Of course, the Printer object is gone, but I'm having trouble finding
the replacement syntax necessary to perform similar actions or set
variables. We are interested in doing this inline (no pop-up dialog
box). Specifically, where how would I replace the following
properties/methods of the old Printer objects.

Printer.NewPage
Printer.TextHei ght
Printer.TextWid th
Printer.PaintPi cture
Printer.Print
Printer.Line
Printer.EndDoc


Maybe this helps:
http://msdn.microsoft.com/library/en...albasicnet.asp
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Jul 21 '05 #2
Thanks for the link. I looked up TextHeight and TextWidth in that
conversion table, and it said "Font parameter of Graphics.Drawst ring". When
I type the statement System.Drawing. Graphics. it does not even give
DrawString as a potential selection from the dropdown list of methods and
properties. There are 4 choices, but DrawString isn't one of them. TIA for
any help in this matter.

"Armin Zingler" <az*******@free net.de> wrote in message
news:uT******** ******@TK2MSFTN GP12.phx.gbl...
"Tom Berry" <tb***@planetes hop.com> schrieb
We currently are trying our first transformation from VB6 to VB.Net.
Of course, the Printer object is gone, but I'm having trouble finding
the replacement syntax necessary to perform similar actions or set
variables. We are interested in doing this inline (no pop-up dialog
box). Specifically, where how would I replace the following
properties/methods of the old Printer objects.

Printer.NewPage
Printer.TextHei ght
Printer.TextWid th
Printer.PaintPi cture
Printer.Print
Printer.Line
Printer.EndDoc
Maybe this helps:

http://msdn.microsoft.com/library/en...albasicnet.asp

--
Armin

Jul 21 '05 #3
"Tom Berry" <tb***@planetes hop.com> schrieb
Thanks for the link. I looked up TextHeight and TextWidth in that
conversion table, and it said "Font parameter of
Graphics.Drawst ring". When I type the statement
System.Drawing. Graphics. it does not even give DrawString as a
potential selection from the dropdown list of methods and properties.
There are 4 choices, but DrawString isn't one of them. TIA for any
help in this matter.


DrawString is not a shared member, it is an instance member. Means: You need
a graphics object to execute the method. You get the object in the PrintPage
event as a property of the passed argument (e.graphics.dra wstring). At the
bottom of the page linked in my previous post is a "Windows Forms
Print support" link leading you to
http://msdn.microsoft.com/library/en...intsupport.asp
There is more information on the PrintDocument object and it's PrintPage
event.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Jul 21 '05 #4
Tom,
Printing doesn't really work that way anymore. It works more like the
hDc drawing methods used by C++ before. Having said that you should look at
the example printing items using PrintDocument in the help files. Basically
all page drawing is done inside a PrintPage event of the document. Setting
the HasMorePages property of the PrintPageEventA rgs variable to true and
returning will do a new page and then re-enter the event to draw the
following page(s). Setting HasMorePage to false and returning is the
equivalent of Printer.EndDoc. Note that you need to keep track of your
print items outside of the PrintPage event as it gets re-run from the top on
every page.
Text Height/Width are (roughly) equivalent to MeasureString on the
Graphics of the supplied argument (say e for further discussion). So
e.Graphics.Meas ureString("The String", theFont, ...) will return a size with
a height/width (see the various overloads for more detail).
e.Graphics.Draw Image is somewhat like PaintPicture, e.Graphics.Draw String is
like Print and e.Graphics.Draw Line is like Line. You will have to supply
Pens, Fonts, and Brushes to these calls.
Normally I initialize all Fonts, and all non-standard Brushes and Pens
as well as the document datastream in the OnBeginPrint of the derived
PrintDocument class and dispose them properly in OnEndPrint. If you want to
handle landscape/portrait switching set the appropriate flag in the
QueryPageSettin gsEventArgs (e.PageSettings .Landscape) for the
OnQueryPageSett ings event which is performed for each page.

Ron Allen
"Tom Berry" <tb***@planetes hop.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
We currently are trying our first transformation from VB6 to VB.Net. Of
course, the Printer object is gone, but I'm having trouble finding the
replacement syntax necessary to perform similar actions or set variables.
We are interested in doing this inline (no pop-up dialog box).
Specifically, where how would I replace the following properties/methods of the old Printer objects.

Printer.NewPage
Printer.TextHei ght
Printer.TextWid th
Printer.PaintPi cture
Printer.Print
Printer.Line
Printer.EndDoc

Thanks, Tom.

Jul 21 '05 #5
Thanks for your detailed post and to the other responders with the links to
examples. One of my initial problems is I didn't include an Import to
signify I was interested in the Graphics area of System. Without that
definition, I didn't get the listing of Drawstring as a potential method. I
have no C++ background and haven't used classes that much. Perhaps this new
language should have been called C++.Net. With their reliance on classes,
objects, things like += (which I did use and like from C BTW), this IMO is a
lot closer to C++ than it is to Visual Basic. I think the C++ people are
Microsoft must have made most of the decisions on this language while the VB
people were literally out having lunch or something. I'm just surprised I
don't see semicolons at the end of each line. :-)

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Tom,
Printing doesn't really work that way anymore. It works more like the
hDc drawing methods used by C++ before. Having said that you should look at the example printing items using PrintDocument in the help files. Basically all page drawing is done inside a PrintPage event of the document. Setting the HasMorePages property of the PrintPageEventA rgs variable to true and
returning will do a new page and then re-enter the event to draw the
following page(s). Setting HasMorePage to false and returning is the
equivalent of Printer.EndDoc. Note that you need to keep track of your
print items outside of the PrintPage event as it gets re-run from the top on every page.
Text Height/Width are (roughly) equivalent to MeasureString on the
Graphics of the supplied argument (say e for further discussion). So
e.Graphics.Meas ureString("The String", theFont, ...) will return a size with a height/width (see the various overloads for more detail).
e.Graphics.Draw Image is somewhat like PaintPicture, e.Graphics.Draw String is like Print and e.Graphics.Draw Line is like Line. You will have to supply
Pens, Fonts, and Brushes to these calls.
Normally I initialize all Fonts, and all non-standard Brushes and Pens
as well as the document datastream in the OnBeginPrint of the derived
PrintDocument class and dispose them properly in OnEndPrint. If you want to handle landscape/portrait switching set the appropriate flag in the
QueryPageSettin gsEventArgs (e.PageSettings .Landscape) for the
OnQueryPageSett ings event which is performed for each page.

Ron Allen
"Tom Berry" <tb***@planetes hop.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
We currently are trying our first transformation from VB6 to VB.Net. Of
course, the Printer object is gone, but I'm having trouble finding the
replacement syntax necessary to perform similar actions or set variables. We are interested in doing this inline (no pop-up dialog box).
Specifically, where how would I replace the following properties/methods

of
the old Printer objects.

Printer.NewPage
Printer.TextHei ght
Printer.TextWid th
Printer.PaintPi cture
Printer.Print
Printer.Line
Printer.EndDoc

Thanks, Tom.


Jul 21 '05 #6

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

Similar topics

2
22312
by: Patrick Herb | last post by:
Hello, I'm trying to print the content of a RichTextBox from my VB 6 app. What I want is that the CommonDialog shows up, the user selects a printer and the content of the RichTextBox prints to the selected printer. I'm not concerned about the text format. What I tried is something like this CommonDialog1.ShowPrinter
2
9275
by: whirl | last post by:
Hi. I really need some help on this one please. I am trying to print a 12.1 x 12.1cm box to my printer. I have found this code bit I just cant work out what the numbers mean. I know they are something to do with X/Y coordinates but what do the values actually mean . Printer.Line (1000, 2000)-(5000, 4000), vbRed, B
1
9933
by: David Trivette | last post by:
I was wondering if anyone could help me with a MS Access 2002 issue I'm having. Problem - I created a db in Access 97 which worked just fine for several years. In the db the user can generate reports straight to a printer after a query has run. The user of this db just got a new computer with Windows XP and Access 2002. Now when the user runs the report the following error message is displayed:
6
1929
by: Bradley1234 | last post by:
What is the way to send/read bits to the printer port at the hex 3F8-3FF or any other legacy io space?? Does C# include the methods to drive the printer or other ports? tia
6
6005
by: Tom Berry | last post by:
We currently are trying our first transformation from VB6 to VB.Net. Of course, the Printer object is gone, but I'm having trouble finding the replacement syntax necessary to perform similar actions or set variables. We are interested in doing this inline (no pop-up dialog box). Specifically, where how would I replace the following properties/methods of the old Printer objects. Printer.NewPage Printer.TextHeight Printer.TextWidth
3
6319
by: Mika M | last post by:
Hi all! I have made an application for printing simple barcode labels using PrintDocument object, and it's working fine. Barcode printer that I use is attached to the computer, and this computer has drivers installed for this printer, and this printer is shared for the network. Question 1:
5
6484
by: Raman | last post by:
Hello friends, I want to print an ID card. I have one Windows Form that contains front and back side. The printer is printing both front and back side at a time. I am trying to send both sides at a time. But it is printing front side on one card and back side on second card. I want to print both sides in a same card.
2
7125
by: up3umrmuofnz3pd | last post by:
Hi guys, I'm working on a small desktop publishing software project where I need to display the default printer's ink status/level in the status bar of the main form. For the past 2 days I've been trying to find a way of getting the printer ink level from the printer but I haven't been able to find something that's generic. I looked at the: * PJLMON.dll - PJL language commands for parrallel port or USB printers. Got stuck on the...
9
10334
by: id10t error | last post by:
Hello, I am going to be using a Symbol WT4090 to scan items. I need to printer a tag from the Zebra ql320 plus. I am trying to do this is Visual basic 2005. Does anyone know and good site to find out how to do this. I have looked everywhere i know with no luck. Thank you in advance for your help.
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10014
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
9844
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...
0
9689
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
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6514
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();...
0
5119
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...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3780
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

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.