C++时钟程序源代码
来源:百度知道 编辑:UC知道 时间:2024/06/22 02:17:02
先建个windows的窗口,再画个圆,要求显示时钟刻度,并且在0,3,6,9处的刻度与其他的不同,有三个指针分别是时,分,秒。
小弟不胜感激!!!!!!!!!!!!!
吝啬鬼!!才给5分呀!!!
void CClockView::OnDraw(CDC* pDC)
{
CClockDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// Get the client rectangle so that we
// can dynamically fit the clock to
// the window.
RECT Rect;
GetClientRect( &Rect );
// For easier calculations, get the
// x and y coordinates of the
// window center.
int nCenterX = Rect.right / 2;
int nCenterY = Rect.bottom / 2;
// Get the current time.
CTime Time = CTime::GetCurrentTime();
CString strDigits;
int i, x, y;
CSize size;
switch( m_nClockType ){
case CLOCK_ANALOG:
{
// Create a yellow pen with which we'll
// draw the ellipse.
CPen Pen( PS_SOLID, 5, RGB( 255, 255, 0 ) );
// Select the new pen into the DC and
// remember the pen that was selected out.
CPen *pOldPen = pDC->SelectObject( &Pen );
//