int main(void) { uint8_t colorR =0 ,colorG =0 ,colorB =0 ; uint8_t colorR_dir =0 ,colorG_dir =0 ,colorB_dir =0 ; char lcd_text_buff[100]; float GyX =0.0f, GyY =0.0f, GyZ =0.0f; float X_offset =0.0f,Y_offset =0.0f,Z_offset =0.0f; uint32_t i=0; float delay_count=1000.0f; GPIO_Configuration(); USART1_Configuration(); CANx_Config(); CANx_NVIC_Config(); lcd_init(); lcd_drawBackground(20,60,250); lcd_drawBGPersimmon(20, 60, 250); LCD_SetColors(LCD_COLOR_WHITE-1,LCD_COLOR_WHITE); LCD_SetFont(&Font16x24); LCD_DisplayStringLine(LINE(1), (uint8_t*)" CAN Bus DEMO "); DrawNeedle(120,120,60,300.0f,0.0f,200.0f); while (1) { CANx_Transmit(); GPIO_ToggleBits(LED4); Delay_1us(1000); } }
/*--------------------------------------------------------------------------*/ void PegLinearBitmapScale::Draw() { if(!mpCompBitmap) { mpCompBitmap = Screen()->CreateBitmap(mpBkgBitmap->wWidth, mpBkgBitmap->wHeight); } DrawToComposite(); BeginDraw(); PegPoint tPoint; tPoint.x = mReal.wLeft; tPoint.y = mReal.wTop; Bitmap(tPoint, mpCompBitmap); if(!mpNeedleBitmap) { DrawNeedle(); } DrawChildren(); EndDraw(); }
// // Redraws the display from a WM_PAINT message. // void CMeterCtrl::OnPaint() { CPaintDC dc(this); int i; // Draw the dial. dc.SelectStockObject(BLACK_PEN); dc.SelectStockObject(BLACK_BRUSH); dc.Ellipse(&meter_box); // Indicate the scale. dc.SelectObject(&scale_font); dc.SetBkColor(0x00000000); dc.SetTextColor(0x00FFFFFF); dc.DrawText(scale_text, -1, &scale_box, DT_CENTER); // Add the labels and tick marks. dc.SelectObject(&label_font); dc.SelectObject(&marker_pen); for (i = 0; i < label_count; i++) { dc.DrawText(label[i], -1, &label_box[i], DT_CENTER | DT_NOCLIP); dc.MoveTo(tick_mark[i][0]); dc.LineTo(tick_mark[i][1]); } DrawNeedle(); if (show_watermark) DrawWatermark(); }
/*--------------------------------------------------------------------------*/ void PegFiniteDial::Draw() { BeginDraw(); if((mwStyle & AF_TRANSPARENT) && Parent()) { StandardBorder(Parent()->muColors[PCI_NORMAL]); } else { StandardBorder(muColors[PCI_NORMAL]); } // If this is set, we've already calculated the needle pos if(!mbValueSet) { CalcNeedlePos(); } DrawDial(); if(mwStyle & DS_TICMARKS) { DrawTicMarks(); } DrawChildren(); DrawNeedle(); DrawAnchor(); EndDraw(); }
void CAnalogMeter::Update(CDC *pDC) { // if the needle hasn't changed, don't bother updating if ((m_dNeedlePos == m_dNeedlePos_n) && (m_strTLPane == m_strTLPane_n) && (m_strTRPane == m_strTRPane_n)) return; // store the values in the member variables // for availability elsewhere if (m_dNeedlePos != m_dNeedlePos_n) m_dNeedlePos = m_dNeedlePos_n; if (m_strTLPane != m_strTLPane_n) m_strTLPane = m_strTLPane_n; if (m_strTRPane != m_strTRPane_n) m_strTRPane = m_strTRPane_n; // do not support updates if we are not working with // bitmaps images if (!m_boolUseBitmaps) return; // must have created the grid if we are going to // update the needle (the needle locations are // calculateed based on the grid) if (!m_dcGrid.GetSafeHdc()) return; // draw the new needle image DrawNeedle(); // combine the needle with the grid and display the result if (m_boolUseBitmaps) ShowMeterImage (pDC); }
void LEMDCAmMeter::DoDrawSwitch(double v, SURFHANDLE drawSurface){ // 100A = 90 deg and 20A = 270 deg // 180 degress of sweep across 80 amps, for 2.25 degrees per amp v = 220-(v*2.25); DrawNeedle(drawSurface, 49, 49, 25.0, v * RAD); oapiBlt(drawSurface, FrameSurface, 0, 0, 0, 0, 99, 98, SURF_PREDEF_CK); }
void kwxAngularMeter::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC old_dc(this); int w,h ; GetClientSize(&w,&h); ///////////////// // Create a memory DC wxMemoryDC dc; dc.SelectObject(*membitmap); dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(m_cBackColour,wxSOLID)); dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_cBackColour,wxSOLID)); dc.Clear(); if (m_pPreviewBmp && m_pPreviewBmp->Ok()) dc.DrawBitmap( *m_pPreviewBmp, 1, 1 ); /////////////////// //Rettangolo dc.SetPen(*wxThePenList->FindOrCreatePen(m_cBorderColour, 1, wxSOLID)); dc.DrawRectangle(0,0,w,h); //settori DrawSectors(dc) ; //tacche if (m_nTick > 0) DrawTicks(dc); //indicatore lancetta DrawNeedle(dc); //testo valore if (m_bDrawCurrent) { wxString valuetext; valuetext.Printf("%d",m_nRealVal); dc.SetFont(m_Font); dc.DrawText(valuetext, (w / 2) - 10, (h / 2) + 10); } // 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); }
void LEMDCVoltMeter::DoDrawSwitch(double v, SURFHANDLE drawSurface){ // 40V = -35 deg and 20V = 215 deg // 250 degrees of sweep across 20 volts, for 12.5 degrees per volt // 20V = 180+35 v = 240-((v-18)*12.5); DrawNeedle(drawSurface, 49, 49, 25.0, v * RAD); oapiBlt(drawSurface, FrameSurface, 0, 0, 0, 0, 99, 98, SURF_PREDEF_CK); }
// // Set the value being displayed by the meter. It also checks to see if the // display needs to be updated and does so. // void CMeterCtrl::SetValue(double new_value) { BOOL update_watermark = FALSE; int temp_value; // If the value is the same as what we had, we don't need to do anything. if (new_value == value) return; // See if the new value falls outside the current watermark ranges. if (new_value < low_value || low_value == -1) { low_value = new_value; update_watermark = TRUE; } if (new_value > high_value) { high_value = new_value; update_watermark = TRUE; } value = new_value; if (auto_range) // VLD: autoscale the meter { // Derive a new range based on the new_value above temp_value = (int)powf(10.0, floorf(log10f((float)value * 10))); // Determine if we need to reset the range up or down if (temp_value > max_range) SetRange(min_range, temp_value, TRUE); else if (temp_value <= max_range/10) SetRange(min_range, max_range/10, TRUE); // will ratchet down by a decade each time // Calculate the needle angle actual_angle = (int)(value / (max_range - min_range) * NEEDLE_SWEEP); } else { // Make sure that the new value is within the current range and update // the actual angle that the needle should be. if (new_value < min_range) actual_angle = 0; else if (new_value > max_range) actual_angle = NEEDLE_SWEEP; else actual_angle = (int)(value / (max_range - min_range) * NEEDLE_SWEEP); } // See if the needle would move significantly. If not, we're done. if (fabs((double)actual_angle - shown_angle) < NEEDLE_SENSITIVITY) return; // Update the location and angle of the needle's point. DrawNeedle(); if (show_watermark && update_watermark) DrawWatermark(); }
void kwxAngularMeter::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC old_dc(this); int w,h ; GetClientSize(&w,&h); ///////////////// if (m_bNeedRedrawBackground) { ConstructBackground(); m_bNeedRedrawBackground = false; } // Create a memory DC wxMemoryDC dc; wxBitmap a(w,h); dc.SelectObject(a); // //dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(m_cBackColour,wxSOLID)); //dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_cBackColour,wxSOLID)); // dc.Clear(); /* if (m_pPreviewBmp && m_pPreviewBmp->Ok()) dc.DrawBitmap( *m_pPreviewBmp, 1, 1 ); */ dc.Blit(0, 0, w, h, &m_BackgroundDc, 0, 0); //Indicator needle DrawNeedle(dc); //Text value if (m_bDrawCurrent) { wxString valuetext; valuetext.Printf(wxT("%d"),m_nRealVal); dc.SetFont(m_Font); dc.DrawText(valuetext, (w / 2) - 10, (h / 2) + 10); } // 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); }
void AngularMeter::OnPaint(wxPaintEvent &event) { wxPaintDC old_dc(this); // wxPaintDC dc((wxWindow *) this); int w,h ; GetClientSize(&w,&h); if (w != _currentWidth || h != _currentHeight){ delete (_memBitmap); _currentWidth = w; _currentHeight = h; _memBitmap = new wxBitmap(_currentWidth, _currentHeight); } ///////////////// // Create a memory DC wxMemoryDC dc; dc.SelectObject(*_memBitmap); dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(_backgroundColor,wxSOLID)); dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(_backgroundColor,wxSOLID)); dc.Clear(); /////////////////// //Rettangolo dc.SetPen(*wxThePenList->FindOrCreatePen(_borderColor, 1, wxSOLID)); dc.DrawRectangle(0,0,w,h); //settori DrawSectors(dc) ; //tacche DrawTicks( dc ); //indicatore lancetta DrawLabel(dc); //testo valore if (_shouldDrawCurrent) DrawValue(dc); DrawNeedle(dc); //blit into the real DC old_dc.Blit(0,0,_currentWidth,_currentHeight,&dc,0,0); }
// // Set the value being displayed by the meter. It also checks to see if the // display needs to be updated and does so. // void CMeterCtrl::SetValue( double new_value ) { BOOL update_watermark = FALSE; // If the value is the same as what we had, we don't need to do anything. if ( new_value == value ) return; // See if the new value falls outside the current watermark ranges. if ( new_value < low_value || low_value == -1 ) { low_value = new_value; update_watermark = TRUE; } if ( new_value > high_value ) { high_value = new_value; update_watermark = TRUE; } value = new_value; // Make sure that the new value is within the current range and update // the actual angle that the needle should be. if ( new_value < min_range ) actual_angle = 0; else if ( new_value > max_range ) actual_angle = NEEDLE_SWEEP; else actual_angle = (int)(value / (max_range - min_range) * NEEDLE_SWEEP); // See if the needle would move significantly. If not, we're done. if ( fabs(actual_angle - shown_angle) < NEEDLE_SENSITIVITY ) return; // Update the location and angle of the needle's point. DrawNeedle(); if ( show_watermark && update_watermark ) DrawWatermark(); }
void MeterM1::OnPaint() { CPaintDC dc(this); // device context for painting // 获得控件区域 GetClientRect (&m_rectCtrl); CMemDC memDC(&dc, &m_rectCtrl); // 选取圆盘边框半径 m_nRadiusFrame = max(m_rectCtrl.Height(), m_rectCtrl.Width())*9/21; // 获得仪表盘中心点 m_ptMeterCenter = m_rectCtrl.CenterPoint(); m_ptMeterCenter.y += m_nRadiusFrame/10; //绘制仪表盘 if(m_dcBackground.GetSafeHdc()== NULL|| (m_bitmapBackground.m_hObject == NULL)) { m_dcBackground.CreateCompatibleDC(&dc); m_bitmapBackground.CreateCompatibleBitmap(&dc, m_rectCtrl.Width(), m_rectCtrl.Height()) ; m_pBitmapOldBackground = m_dcBackground.SelectObject(&m_bitmapBackground) ; DrawMeterBackground(&m_dcBackground, m_rectCtrl); } memDC.BitBlt(0, 0, m_rectCtrl.Width(), m_rectCtrl.Height(), &m_dcBackground, 0, 0, SRCCOPY) ; // 绘制指针 DrawNeedle(&memDC); DrawNode(&memDC); DrawValue(&memDC); // Do not call CStatic::OnPaint() for painting messages }
/************************************************************************** MUIM_Draw **************************************************************************/ IPTR Levelmeter__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) { struct Levelmeter_DATA *data = INST_DATA(cl, obj); struct RastPort *rp; WORD x1, y1, x2, y2; DoSuperMethodA(cl,obj,(Msg)msg); if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE))) return FALSE; x1 = _mleft(obj); y1 = _mtop(obj); x2 = _mright(obj); y2 = _mbottom(obj); rp = _rp(obj); if (msg->flags & MADF_DRAWOBJECT) { /* Transparent edges */ DoMethod(obj, MUIM_DrawParentBackground, x1, y1, 2, 1, x1, y1, 0); DoMethod(obj, MUIM_DrawParentBackground, x1, y1 + 1, 1, 1, x1, y1 + 1, 0); DoMethod(obj, MUIM_DrawParentBackground, x2 - 1, y1, 2, 1, x2 - 1, y1, 0); DoMethod(obj, MUIM_DrawParentBackground, x2, y1 + 1, 1, 1, x2, y1 + 1, 0); DoMethod(obj, MUIM_DrawParentBackground, x1, y2, 2, 1, x1, y2, 0); DoMethod(obj, MUIM_DrawParentBackground, x1, y2 - 1, 1, 1, x1, y2 - 1, 0); DoMethod(obj, MUIM_DrawParentBackground, x2 - 1, y2, 2, 1, x2 - 1, y2, 0); DoMethod(obj, MUIM_DrawParentBackground, x2, y2 - 1, 1, 1, x2, y2 - 1, 0); /* Outer frame */ SetABPenDrMd(rp, _pens(obj)[MPEN_SHINE], 0, JAM1); Move(rp, x1 + 1, y2 - 1); Draw(rp, x1, y2 - 2); Draw(rp, x1, y1 + 2); Draw(rp, x1 + 2, y1); Draw(rp, x2 - 2, y1); Draw(rp, x2 - 1, y1 + 1); SetAPen(rp, _pens(obj)[MPEN_SHADOW]); Move(rp, x2, y1 + 2); Draw(rp, x2, y2 - 2); Draw(rp, x2 - 2, y2); Draw(rp, x1 + 2, y2); SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]); Move(rp, x1 + 1, y2 - 2); Draw(rp, x1 + 1, y1 + 2); Draw(rp, x1 + 2, y1 + 1); Draw(rp, x2 - 2, y1 + 1); SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]); Move(rp, x2 - 1, y1 + 2); Draw(rp, x2 - 1, y2 - 2); Draw(rp, x2 - 2, y2 - 1); Draw(rp, x1 + 2, y2 - 1); /* Border */ x1 += OUTERFRAME_X; x2 -= OUTERFRAME_X; y1 += OUTERFRAME_X; y2 -= OUTERFRAME_Y; SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]); RectFill(rp, x1, y1, x2, y1 + BORDERSIZE_Y - 1); RectFill(rp, x1, y1 + BORDERSIZE_Y, x1 + BORDERSIZE_X - 1, y2); RectFill(rp, x1 + BORDERSIZE_X - 1, y2 - BORDERSIZE_Y + 1, x2, y2); RectFill(rp, x2 - BORDERSIZE_X + 1, y1 + BORDERSIZE_Y, x2, y2 - BORDERSIZE_Y); /* Inner Frame */ x1 += BORDERSIZE_X; x2 -= BORDERSIZE_X; y1 += BORDERSIZE_Y; y2 = y1 + LEVEL_HEIGHT + INNERFRAME_H - 1; Move(rp, x1, y1); Draw(rp, x1 + 2, y1); Draw(rp, x1, y1 + 2); Draw(rp, x1, y1 + 1); Move(rp, x2, y1); Draw(rp, x2 - 2, y1); Draw(rp, x2, y1 + 2); Draw(rp, x2, y1 + 1); Move(rp, x1, y2); Draw(rp, x1 + 2, y2); Draw(rp, x1, y2 - 2); Draw(rp, x1, y2 - 1); Move(rp, x2, y2); Draw(rp, x2 - 2, y2); Draw(rp, x2, y2 - 2); Draw(rp, x2, y2 - 1); SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]); Move(rp, x1 + 2, y2 - 1); Draw(rp, x1, y2 - 3); Draw(rp, x1, y1 + 3); Draw(rp, x1 + 3, y1); Draw(rp, x2 - 3, y1); Draw(rp, x2 - 1, y1 + 2); SetAPen(rp, _pens(obj)[MPEN_SHINE]); Move(rp, x2, y1 + 3); Draw(rp, x2, y2 - 3); Draw(rp, x2 - 3, y2); Draw(rp, x1 + 3, y2); SetAPen(rp, _pens(obj)[MPEN_SHADOW]); Move(rp, x1 + 3, y1 + 1); Draw(rp, x2 - 3, y1 + 1); Move(rp, x1 + 1, y1 + 3); Draw(rp, x1 + 1, y2 - 3); Move(rp, x1 + 3, y2 - 1); Draw(rp, x2 - 3, y2 - 1); Move(rp, x2 - 1, y1 + 3), Draw(rp, x2 - 1, y2 - 3); /* Levelmeter bg */ x1 += INNERFRAME_X; x2 -= INNERFRAME_X; y1 += INNERFRAME_Y; y2 -= INNERFRAME_Y; SetAPen(rp, data->levelbgpen); RectFill(rp, x1 + 1, y1, x2 - 1, y1); RectFill(rp, x1, y1 + 1, x2, y2 - 1); RectFill(rp, x1 + 1, y2, x2 - 1, y2); SetAPen(rp, _pens(obj)[MPEN_SHADOW]); WritePixel(rp, x1, y1); WritePixel(rp, x2, y1); WritePixel(rp, x1, y2); WritePixel(rp, x2, y2); /* Levelmeter scale */ DrawScale(rp, x1, y1, x2, y2, _pens(obj)[MPEN_SHINE]); /* Level-Label spacing */ x1 -= INNERFRAME_X; x2 += INNERFRAME_X; y1 = y2 + INNERFRAME_Y + 1; SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]); RectFill(rp, x1, y1, x2, y1 + LEVEL_LABEL_SPACING - 1); /* Label Frame */ y1 += LEVEL_LABEL_SPACING; y2 = _mbottom(obj) - OUTERFRAME_Y - BORDERSIZE_Y; SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]); Move(rp, x1, y1); Draw(rp, x1 + 1, y1); Draw(rp, x1, y1 + 1); Move(rp, x2, y1); Draw(rp, x2 - 1, y1); Draw(rp, x2, y1 + 1); Move(rp, x1, y2); Draw(rp, x1 + 1, y2); Draw(rp, x1, y2 - 1); Move(rp, x2, y2); Draw(rp, x2 - 1, y2); Draw(rp, x2, y2 - 1); SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]); Move(rp, x1 + 1, y2 - 1); Draw(rp, x1, y2 - 2); Draw(rp, x1, y1 + 2); Draw(rp, x1 + 2, y1); Draw(rp, x2 - 2, y1); Draw(rp, x2 - 1, y1 + 1); SetAPen(rp, _pens(obj)[MPEN_SHINE]); Move(rp, x2, y1 + 2); Draw(rp, x2, y2 - 2); Draw(rp, x2 - 2, y2); Draw(rp, x1 + 2, y2); SetAPen(rp, _pens(obj)[MPEN_SHADOW]); RectFill(rp, x1 + 1, y1 + 2, x1 + 1, y2 - 2); RectFill(rp, x2 - 1, y1 + 2, x2 - 1, y2 - 2); RectFill(rp, x1 + 2, y1 + 1, x2 - 2, y1 + 1); RectFill(rp, x1 + 2, y2 - 1, x2 - 2, y2 - 1); /* Label Bg */ RectFill(rp, x1 + 2, y1 +2, x2 - 2, y2 - 2); } x1 = _mleft(obj) + OUTERFRAME_X + BORDERSIZE_X + INNERFRAME_X; x2 = _mright(obj) - OUTERFRAME_X - BORDERSIZE_X - INNERFRAME_X; y1 = _mtop(obj) + OUTERFRAME_Y + BORDERSIZE_Y + INNERFRAME_Y; y2 = y1 + LEVEL_HEIGHT - 1; if (msg->flags & MADF_DRAWUPDATE) { DrawNeedle(rp, x1, y1, x2, y2, data->prevangle, data->levelbgpen); } data->prevangle = (double)DoMethod(obj, MUIM_Numeric_ValueToScale, 0, 180); DrawNeedle(rp, x1, y1, x2, y2, data->prevangle, _pens(obj)[MPEN_SHINE]); return TRUE; }
void CAnalogMeter::ShowMeter(CDC * pDC, CRect rectBorder) { // check for a new meter or a resize of the old one. // (if the rectangles have changed, then redraw from scratch). // If we are printing, always draw from scratch without bitmaps. if (m_rectOwner != rectBorder) m_boolForceRedraw = true; if (m_boolForceRedraw || (pDC->IsPrinting())) { m_boolForceRedraw = false; // first store the rectangle for the owner // and determine the rectangle to draw to m_rectOwner = rectBorder; if (pDC->IsPrinting()) { m_boolUseBitmaps = false; m_rectDraw = m_rectOwner; // draw directly to the owner } else { m_boolUseBitmaps = true; m_rectDraw.left = 0; // draw to a bitmap rectangle m_rectDraw.top = 0; m_rectDraw.right = rectBorder.Width(); m_rectDraw.bottom = rectBorder.Height(); } m_nRectWidth = m_rectDraw.Width(); m_nRectHeight = m_rectDraw.Height(); // if we already have a memory dc, destroy it // (this occurs for a re-size of the meter) if (m_dcGrid.GetSafeHdc()) { m_dcGrid.SelectObject(m_pbitmapOldGrid); m_dcGrid.DeleteDC(); m_dcNeedle.SelectObject(m_pbitmapOldNeedle); m_dcNeedle.DeleteDC(); m_bitmapGrid.DeleteObject(); m_bitmapNeedle.DeleteObject(); } if (m_boolUseBitmaps) { // create a memory based dc for drawing the grid m_dcGrid.CreateCompatibleDC(pDC); m_bitmapGrid.CreateCompatibleBitmap(pDC, m_nRectWidth, m_nRectHeight); m_pbitmapOldGrid = m_dcGrid.SelectObject(&m_bitmapGrid); // create a memory based dc for drawing the needle m_dcNeedle.CreateCompatibleDC(pDC); m_bitmapNeedle.CreateCompatibleBitmap(pDC, m_nRectWidth, m_nRectHeight); m_pbitmapOldNeedle = m_dcNeedle.SelectObject(&m_bitmapNeedle); } else // no bitmaps, draw to the destination { // use the destination dc for the grid m_dcGrid.m_hDC = pDC->m_hDC; m_dcGrid.m_hAttribDC = pDC->m_hAttribDC; // use the destination dc for the grid m_dcNeedle.m_hDC = pDC->m_hDC; m_dcNeedle.m_hAttribDC = pDC->m_hAttribDC; } // draw the grid in to the "grid dc" DrawScale(); // draw the needle in the "needle dc" DrawNeedle(); } // display the new image, combining the needle with the grid if (m_boolUseBitmaps) ShowMeterImage(pDC); }
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); }