Page 1 of 1

Drawing problem on windows

Posted: Thu Jan 12, 2017 9:16 am
by Maeglix
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

Re: Drawing problem on windows

Posted: Thu Jan 12, 2017 9:53 am
by doublemax
Add the wxFULL_REPAINT_ON_RESIZE style flag when creating the window.

Re: Drawing problem on windows

Posted: Thu Jan 12, 2017 10:09 am
by Maeglix
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.

Re: Drawing problem on windows

Posted: Thu Jan 12, 2017 12:11 pm
by doublemax
I assume you're talking about flickering display? Replace wxPaintDC with wxBufferedPaintDC ( include wx/dcbuffer.h )