为了摆脱闪烁,我使用wxBufferedPaintDC来代替wxPaintDC。但是有一个问题。在我的绘画函数中,为了绘制立方beizer曲线,我必须使用GetGraphicsContext来创建路径。我的问题是为什么GetGraphicsContext在使用wxBufferedPaintDC时返回NULL指针。wxBufferedPaintDC GetGraphicsContext返回NULL指针
void DotGraphView::OnPaint(wxPaintEvent & WXUNUSED(evt))
{
wxBufferedPaintDC dc(this);
PrepareDC(dc);
PaintBackground(dc);
wxGCDC &gdc = (wxGCDC&)dc;
wxGraphicsContext * gc = gdc.GetGraphicsContext(); /* here gc = NULL */
wxGraphicsPath path = gc->CreatePath(); /* program collapses here */
...
}
我看了页面,但它不起作用。 – allenchen 2012-04-11 08:27:14