Drawing problem on windows

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.
Maeglix
Knows some wx things
Knows some wx things
Posts: 25
Joined: Thu Nov 17, 2016 8:07 am

Drawing problem on windows

Postby Maeglix » Thu Jan 12, 2017 9:16 am

Hi all !

I'm trying to draw a map using a class extended from wxPanel and wxDC (like in the sample).

So i have this :

Code: Select all

void GADrawingArea::paintEvent(wxPaintEvent & evt)
{
    wxPaintDC dc(this);
    render(dc);
}



Code: Select all

void GADrawingArea::render(wxDC&  dc)
{
   dc.Clear();
   int x,y;
   GetPosition(&x,&y);
   m_winC.update_geometry(x, y, GetSize().GetWidth(), GetSize().GetHeight(),true);  // used to update the information of the window contained in m_winc
   setScale(HorizontalBottom, "nm", dc); //used to draw h axe
   setScale(VerticalLeft, "nm", dc); // used to draw v axe
}


The problem is that it's works perfectly on linux but on windows, when i resize the window i have this :

Image

I really don't know where is the problem because even looking my logs i dont see a problem.
Thanks for your help

User avatar
doublemax
Moderator
Moderator
Posts: 10655
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drawing problem on windows

Postby doublemax » Thu Jan 12, 2017 9:53 am

Add the wxFULL_REPAINT_ON_RESIZE style flag when creating the window.
Use the source, Luke!

Maeglix
Knows some wx things
Knows some wx things
Posts: 25
Joined: Thu Nov 17, 2016 8:07 am

Re: Drawing problem on windows

Postby Maeglix » Thu Jan 12, 2017 10:09 am

Oh thanks, i didn't expected that it was such a simple issue.

I have just a little problem now, it seems like the v axes is disappearing and reappearing very fast while i'm resizing. I would think that's it's normal since the window is full repainting but as it doesn't do it for the horizontal axes i'm not sure.

User avatar
doublemax
Moderator
Moderator
Posts: 10655
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drawing problem on windows

Postby doublemax » Thu Jan 12, 2017 12:11 pm

I assume you're talking about flickering display? Replace wxPaintDC with wxBufferedPaintDC ( include wx/dcbuffer.h )
Use the source, Luke!


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 5 guests