ActiveX ñ íóëÿ

         

Èçìåíåíèå ìåòîäà Draw.


Âíåñåííûå èçìåíåíèÿ ïîêàçàíû æèðíûì øðèôòîì.

void CMyCtrlCtrl::OnDraw(

              CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)

{

     CPen pen;

     CBrush foreBrush, backBrush;

     CPoint points[3];

     pdc->SaveDC();

     pen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));

     ULONG foreColor = TranslateColor(GetForeColor());

     backBrush.CreateSolidBrush(TranslateColor(AmbientBackColor()));

     foreBrush.CreateSolidBrush(GetSelected() ? foreColor : TranslateColor(m_selectColor));

     pdc->FillRect(rcBounds, &backBrush);

     pdc->SelectObject(&pen);

     pdc->SelectObject(&foreBrush);

     switch (m_nShape)



     {

     case 0:

          pdc->Ellipse(rcBounds);

          break;

     case 1:

          pdc->Rectangle(rcBounds);

          break;

     case 2:

          points[0].x = rcBounds.left;

          points[0].y = rcBounds.bottom - 1;

          points[1].x = (rcBounds.left + rcBounds.right - 1) / 2;

          points[1].y = rcBounds.top;

          points[2].x = rcBounds.right - 1;

          points[2].y = rcBounds.bottom - 1;

          pdc->Polygon(points, 3);

          break;

     }

     pdc->RestoreDC(-1);

}



Ñîäåðæàíèå ðàçäåëà