void kwxLinearMeter::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); int w,h; int yPoint, rectHeight ; GetClientSize(&w,&h); ///////////////// // Create a memory DC wxMemoryDC temp_dc; temp_dc.SelectObject(*membitmap); temp_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(*m_cPassiveBar,wxSOLID)); temp_dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*m_cPassiveBar,wxSOLID)); temp_dc.Clear(); /////////////////// temp_dc.SetPen(*wxThePenList->FindOrCreatePen(*m_cBorderColour, 1, wxSOLID)); temp_dc.DrawRectangle(0, 0, w, h); temp_dc.SetPen(*wxThePenList->FindOrCreatePen(*m_cActiveBar, 1, wxSOLID)); temp_dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*m_cActiveBar,wxSOLID)); if(m_bDirOrizFlag) temp_dc.DrawRectangle(1, 1, m_nScaledVal, h - 2); else { yPoint = h - m_nScaledVal ; if (m_nScaledVal == 0 ) rectHeight = m_nScaledVal ; else { if (m_nRealVal == m_nMax) { rectHeight = m_nScaledVal; yPoint -= 1 ; } else rectHeight = m_nScaledVal - 1 ; } temp_dc.DrawRectangle(1, yPoint, w - 2, rectHeight); } if (m_bShowCurrent) DrawCurrent(temp_dc); //valore attuale if (m_bShowLimits) DrawLimits(temp_dc); //valore minimo e massimo if (m_nTagsNum > 0 ) DrawTags(temp_dc) ; // We can now draw into the memory DC... // Copy from this DC to another DC. dc.Blit(0, 0, w, h, &temp_dc, 0, 0); }
void kwxLinearReg::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC old_dc(this); int w,h; int yPoint, rectHeight ; GetClientSize(&w,&h); wxMemoryDC dc; dc.SelectObject(*m_pMembitmap); dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(*m_pPassiveBarColour,wxSOLID)); dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*m_pPassiveBarColour,wxSOLID)); dc.Clear(); /////////////////////////////////////////////////////////////////////////// dc.SetPen(*wxThePenList->FindOrCreatePen(*m_pBorderColour, 1, wxSOLID)); dc.DrawRectangle(0, 0, w, h); dc.SetPen(*wxThePenList->FindOrCreatePen(*m_pActiveBarColour, 1, wxSOLID)); dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*m_pActiveBarColour,wxSOLID)); if((!(m_iStyle&STYLE_VERTICAL))) dc.DrawRectangle(1, 1, m_iScaledVal, h - 2); else { yPoint = h - m_iScaledVal ; if (m_iScaledVal == 0 ) rectHeight = m_iScaledVal ; else { if (m_iRealVal == m_iMax) { rectHeight = m_iScaledVal; yPoint -= 1 ; } else rectHeight = m_iScaledVal - 1 ; } dc.DrawRectangle(1, yPoint, w - 2, rectHeight); } if (m_iStyle & STYLE_METER) { DrawNeedle(dc); // draw needle } if (m_iStyle & STYLE_DRAW_CURRENT) DrawCurrent(dc); //valore attuale if (m_iStyle & STYLE_DRAW_LIMITS) DrawLimits(dc); //valore minimo e massimo if (m_iTagsCount > 0 ) DrawTags(dc) ; // draw tags // We can now draw into the memory DC... // Copy from this DC to another DC. old_dc.Blit(0, 0, w, h, &dc, 0, 0); }