DC SetAxisOrientation Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
tigerbeard
Earned some good credits
Earned some good credits
Posts: 126
Joined: Sat Oct 07, 2006 1:56 pm

DC SetAxisOrientation

Post by tigerbeard »

I guess I ran into an old problem, but I could not really find an answer in the forums applicable to MSW port.

I'm using wxPaintDC to render some lines on a wxPanel surface. I wanted to use wxPaintDC::SetAxisOrientation(true, true) so I could have my origin in the lower left.

Code: Select all

Code snippet from OnPaint():

wxPaintDC* pDc(this);
pDc->SetAxisOrientation(true,true);    // testline
pDC->SetPen(*wxWHITE_PEN);
// draws cross with one thicker line
pDC->DrawLine(0,  0, 1000,300);
pDC->DrawLine(0,300, 1000,  0);
pDC->DrawLine(0,301, 1000,  1);

Works fine w/o the testLine, I can scale the window and see my lines fixed in the upper left.
With the testLine I would expect to see my lines, but fixed in lower left. Instead I do not see any lines. I could not figure this out..

I guess I do have a wrong understanding of what the function SetAxisOrientation() is supposed to be doing.

Maybe someone has a quick hint for me.
Thanks
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
User avatar
doublemax
Moderator
Moderator
Posts: 19161
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax »

I guess SetAxisOrientation() doesn't move the origin, try adding something like this before SetAxisOrientation():

Code: Select all

dc.SetDeviceOrigin( 0, dc.GetSize().GetHeight()-1 );
Use the source, Luke!
tigerbeard
Earned some good credits
Earned some good credits
Posts: 126
Joined: Sat Oct 07, 2006 1:56 pm

Post by tigerbeard »

doublemax wrote:I guess SetAxisOrientation() doesn't move the origin, try adding something like this before SetAxisOrientation():

Code: Select all

dc.SetDeviceOrigin( 0, dc.GetSize().GetHeight()-1 );
Thanks doublemax, that did the job!
Actually I did try SetAxisOrientation, but with the parameters (0,0) which obviously wasn't any good.

Regards
tiger
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
Post Reply