Top left image position

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
dkaip
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 202
Joined: Wed Jan 20, 2010 1:15 pm

Top left image position

Postby dkaip » Sat Jun 02, 2018 5:18 am

Hello.
Inserting an image in a page with Image(file) function, i dont know the top left corner of image in pdf page?
How i can find it?
Code bellow don't gives me top left.
Thank's
Jim

Code: Select all

aFile.Line(aFile.GetRightMargin(),aFile.GetTopMargin(),aFile.GetLastImageBottomRightX(),aFile.GetLastImageBottomRightY());

dkaip
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 202
Joined: Wed Jan 20, 2010 1:15 pm

Re: Top left image position

Postby dkaip » Sat Jun 02, 2018 5:27 am

As i Just see is code ok? from top left to bottom down?
It works, but is the right way?

Code: Select all

double x=aFile.GetX();
double y=aFile.GetY();
aFile.Line(x,y,aFile.GetLastImageBottomRightX(),aFile.GetLastImageBottomRightY());

utelle
Moderator
Moderator
Posts: 828
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: Top left image position

Postby utelle » Thu Jun 07, 2018 6:21 pm

dkaip wrote:As i Just see is code ok? from top left to bottom down?
It works, but is the right way?

Code: Select all

double x=aFile.GetX();
double y=aFile.GetY();
aFile.Line(x,y,aFile.GetLastImageBottomRightX(),aFile.GetLastImageBottomRightY());

When calling method Image to insert an image into the PDF document, you have to specify explicitly where to place the top left corner of the image via arguments x and y. If you want to draw a line from that position to the bottom right corner, you have to remember the coordinates of the top left corner, because the current position (which you get from GetX and GetY) could possibly change, except that no output action other than inserting the image takes place before you draw the line.

Regards,

Ulrich

dkaip
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 202
Joined: Wed Jan 20, 2010 1:15 pm

Re: Top left image position

Postby dkaip » Tue Jun 12, 2018 3:11 pm

Thank's, as i see i must catch coordinates immediately after image inserting.
Jim


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 0 guests