ActiveX


MyCtrlCtl.cpp - 6


}

 

void CMyCtrlCtrl::SetShape(short nNewValue)

{

m_nShape = nNewValue;

SetModifiedFlag();

InvalidateControl();

}

 

BOOL CMyCtrlCtrl::GetSelected()

{

 

return m_bSelected;

}

 

void CMyCtrlCtrl::OnLButtonDown(UINT nFlags, CPoint point)

{

COleControl::OnLButtonDown(nFlags, point);

m_bSelected = !m_bSelected;

InvalidateControl();

FireSelect(m_bSelected);

}

 

 

OLE_COLOR CMyCtrlCtrl::GetSelectColor()

{

return m_selectColor;

}

 

void CMyCtrlCtrl::SetSelectColor(OLE_COLOR nNewValue)

{

m_selectColor = nNewValue;

SetModifiedFlag();

InvalidateControl();

}

 

OLE_COLOR CMyCtrlCtrl::GetTextColor()

{

return m_textColor;

}

 

void CMyCtrlCtrl::SetTextColor(OLE_COLOR nNewValue)

{

m_textColor = nNewValue;

SetModifiedFlag();

InvalidateControl();

}

 

 

 

 

long CMyCtrlCtrl::GetSleep()

{

return m_timeSleep;

}

 

void CMyCtrlCtrl::SetSleep(long nNewValue)

{

m_timeSleep = nNewValue;

SetModifiedFlag();

}

 

void CMyCtrlCtrl::OnTimer(UINT nIDEvent)

{

m_tick++;

FireTick(m_tick);

SetModifiedFlag();

InvalidateControl();

COleControl::OnTimer(nIDEvent);

}

 

#define ID_TIMER 1001

 

int CMyCtrlCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

if (COleControl::OnCreate(lpCreateStruct) == -1)

return -1;

idTimer = SetTimer( ID_TIMER, m_timeSleep, NULL );

timerOn = FALSE;

return 0;

}

 

void CMyCtrlCtrl::OnClose()

{

if ( timerOn )

{

KillTimer( idTimer );

timerOn =FALSE;

}

CWnd::OnClose();

}

 

BOOL CMyCtrlCtrl::DoChangeTimer()

{

if ( timerOn )

{

KillTimer( idTimer );

timerOn =FALSE;

}

else

{

idTimer = SetTimer( ID_TIMER, m_timeSleep, NULL );

timerOn =TRUE;

}

return timerOn;

}

 




- -  - -  - -