Groups | Blog | Home
all groups > vb.net > april 2005 >

vb.net : Current PrintDocument Coordinates


hclarius
4/27/2005 4:21:33 PM
Is there any way programmatically to get the values of the
PrintDocument's current position (x and y)?
Zanna
4/29/2005 12:00:00 AM
"hclarius" <hfclarius@nospamcomcast.net> ha scritto nel messaggio news:%

[quoted text, click to view]

Since you print objects to the document at specified coordinates it make no
sense to have a current x/y position.

If you need something like the old VB Print object you can try my report
engine: it cames with a designer but you can build your prints at runtime in
a more structured way ;)

see the signature link

--
Reporting tool: http://www.neodatatype.net

Hclarius
4/29/2005 12:00:00 AM
The reason (although it may not make sense to you) is as follows:
I have two string variables, one represents a label (for display, not a VB
"label" object) and the other represents the value associated with this
"label".
I specify the x and y coordinate and print the label. Now I wish to change
my pens color (or whatever) and print the labels value following the label,
but I don't know the x and y coordinates to use for the "value" string.

What I would like to do is:
1. Set the x and y coordinates for the "label" string
2. Drawstring() - print the "label" string
3. Get the current x and y coordinates - the PointF where the printer is now
located
3. Set the x and y coordinates for the "value" string
4. Drawstring() - print the "value" string at these new coordinates

Does this make sense now?


[quoted text, click to view]

Zanna
4/29/2005 12:00:00 AM
"Hclarius" <hfclarius@nospamcomcast.net> ha scritto nel messaggio
news:uPt7aOLTFHA.3544@TK2MSFTNGP10.phx.gbl...


[quoted text, click to view]

Yes, but the concept is wrong.
Your string is a graphic object, so if you i.e. change the font size you
won't get the right position for the new text.

However you can compute the size of a "label" using the
Graphics.MeasureString() method, and then "move" the cursor to the new
position.

--
Reporting tool: http://www.neodatatype.net


AddThis Social Bookmark Button