PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

How to change XPoint positions when adding DrawString w/loop
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4288
Page 1 of 1

Author:  Flidrip [ Thu Sep 30, 2021 10:13 am ]
Post subject:  How to change XPoint positions when adding DrawString w/loop

I am using a
Code:
foreach
loop to `DrawString` to my PDF document, but the problem is, they're all added to the same
Code:
XPoint
position.
Like this:

Code:
foreach (this in that) {
   
    string myString = listName.Key;
   
    gfx.DrawString(myString, /* font & color code */, new XPoint(50, 50));
}


How can I make the
Code:
XPoint
add, let's say, 50 pixels to the Y position per iteration of the loop?

Author:  Flidrip [ Thu Sep 30, 2021 11:57 am ]
Post subject:  Re: How to change XPoint positions when adding DrawString w/

I was a bit quick in creating a question.

I fixed it by defining int y outside of the foreach, and adding +50 to it inside the loop with
Code:
y += 50

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/