Current PrintDocument Coordinates

  • Thread starter Thread starter hclarius
  • Start date Start date
H

hclarius

Is there any way programmatically to get the values of the
PrintDocument's current position (x and y)?
Thanks
 
hclarius said:
Is there any way programmatically to get the values of the PrintDocument's
current position (x and y)?

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
 
"Hclarius" <[email protected]> ha scritto nel messaggio

Does this make sense now?

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.
 
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?
 
Back
Top