BCGcontrolBar(七) 添加仪表盘、动态图表显示等控件

时间:2021-09-26 14:23:09

BCGcontrolBar(七) 添加仪表盘、动态图表显示等控件

BCG的 BCGPGaugesDemo有众多仪表盘控件可以参考使用

编写时同ListCtrl一样 在停靠面板上加入仪表盘和动态曲线

主要代码

    //插入CPU图形
pContainer->SetFillBrush(CBCGPBrush(
CBCGPColor(CBCGPColor::Silver, .
1), CBCGPColor::White, CBCGPBrush::BCGP_GRADIENT_RADIAL_BOTTOM_RIGHT));
pContainer
->SetOutlineBrush(CBCGPBrush(CBCGPColor:: Gray));

m_pGaugeCPU
= new CBCGPCircularGaugeImpl(pContainer);
// m_pGaugeCPU->SetRange(0., MAX_CPU);


m_pGaugeCPU
->SetRange(0.,5000);
m_pGaugeCPU
->SetMajorTickMarkStep(10);
m_pGaugeCPU
->SetStep(50);

//m_pGaugeCPU->SetScaleRatio()

m_pGaugeCPU
->SetColors(CBCGPCircularGaugeColors::BCGP_CIRCULAR_GAUGE_WHITE);
m_pGaugeCPU
->AddSubGauge(new CBCGPTextGaugeImpl(_T("幅度(mv)"), CBCGPColor::SteelBlue),
CBCGPGaugeImpl::BCGP_SUB_GAUGE_BOTTOM, CBCGPSize(
0, 0), CBCGPPoint(0, 10));



CBCGPBrush brRed(CBCGPColor::Firebrick, CBCGPColor::White, CBCGPBrush::BCGP_GRADIENT_DIAGONAL_LEFT);
m_pGaugeCPU
->AddColoredRange(3250, 5000, brRed, CBCGPBrush(), 0, 7.);
CBCGPBrush brGreen(CBCGPColor::Green, CBCGPColor::White, CBCGPBrush::BCGP_GRADIENT_DIAGONAL_LEFT);
m_pGaugeCPU
->AddColoredRange(0., 1650., brGreen, CBCGPBrush(), 0, 7.);