Drawing

Previous chapterNext chapter Show allShow all    Hide allHide all

With DoSuperclassPaint the SliderCtrl is drawn (as is is a subclassed control). If at the moment of drawing the slider is moved, the variable m_bInitialized gets the value FALSE. This makes sure, that the value can be changed. Normally the value of the variable is read and displayed with the method SetPos of the SliderCtrl.

void CCD_SliderCtrlCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)

{

//*** update view

DoSuperclassPaint(pdc, rcBounds);

if (m_interfaceVariable && m_bInitialized) {

COleVariant cValue(m_interfaceVariable.GetValue());

int nValue = (int) VariantToDouble(&cValue.Detach());

m_wndSliderCtrl.SetPos(nValue);

}

}