PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Oct 17, 2021 6:28 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Sep 30, 2021 10:13 am 
Offline

Joined: Tue Sep 28, 2021 8:33 am
Posts: 4
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?


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 30, 2021 11:57 am 
Offline

Joined: Tue Sep 28, 2021 8:33 am
Posts: 4
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group