看到一个界面程序,在一个对话框的静态文本控件内绘制一个时钟
创建了一个DrawClock()成员函数用于绘制时钟
void CClockDlg::DrawClock()
{ CClientDC dc(this);
//dc=m_frame.GetTopWindow ()->GetDC ();
CRect rect;
m_frame.GetClientRect (rect);
int x=rect.left +rect.Width ()/2+10;
int y=rect.top +rect.Height ()/2+10;
dc.Ellipse (x-110,y-110,x+110,y+110);
dc.Ellipse (x-115,y-115,x+115,y+115);
  ...
}并在OnPaint()函数中调用
void CClockDlg::OnPaint()  
{
if (IsIconic())
{
CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
dc.TextOut (50,100,"这是一个时钟");
}
else
{
CDialog::OnPaint();
}
DrawClock();
}不太明白是如何绘制的?是否是说在每次绘制对话框的时候都会调用DrawClock()函数进行绘制时钟?
那DrawClock()函数中的CClientDC dc(this);是如何同时钟所在的静态文本控件取得联系的,而不是其他的控件?
静态文本这样绘制图形时还需要接收消息么?
初学VC,有劳各位大神指教