资源预览内容
第1页 / 共11页
第2页 / 共11页
第3页 / 共11页
第4页 / 共11页
第5页 / 共11页
第6页 / 共11页
第7页 / 共11页
第8页 / 共11页
第9页 / 共11页
第10页 / 共11页
亲,该文档总共11页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
vc编写一个模拟时钟的程序(VC write an analog clock program)Im sorry, my program is too big, 4M, because there are other functionsNo way. Towel section proceduresVoid CFill_areaView: myShowColok (CDC, *pDC)M_time=CTime: GetCurrentTime ();PDC-FillRect (&CRect (0,0, rect.Width (), rect.Height (), &CBrush (RGB (100100100);CBrush brush (RGB (150150150);CBrush *oldbrush=pDC-SelectObject (&brush);CPen pen (PS_SOLID, 3, RGB (0,0,0);CPen *oldpen=pDC-SelectObject (&pen);PDC-Ellipse (rect.Width (), /2- (rect.Height (), /2, rect.Height () (/2-10 (), /2- (rect.Height (), /2, rect.Width (), /2+ (rect.Height (), /2, rect.Height () (&CRect (), /2+ (rect.Height (), /2-10 (/2-10) /2) /2-10 ();PDC-Ellipse (&CRect (rect.Width (), /2-3, rect.Height (), /2-3, rect.Width (), /2+3, rect.Height () /2+3);CPen PEN2 (PS_SOLID, 7, RGB (0,0,0);PDC-SelectObject (&pen2);PDC-MoveTo (rect.Width (), /2, rect.Height (), /2-16* (rect.Height (), /2-10) /20);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20, rect.Height (), /2-6* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20, rect.Height (), /2-6* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2, rect.Height (), /2-16* (rect.Height (), /2-10) /20);PDC-MoveTo (rect.Width (), /2-15* (rect.Height (), /20+25, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20+25, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20+25+40, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20+25+40, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-MoveTo (rect.Width (), /2+15* (rect.Height (), /20-25, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20-25, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20-25-40, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20-25-40, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);CPen pen1 (PS_SOLID, 1, RGB (0,0,0);PDC-SelectObject (&pen1);Double alpha=0;MyPoint, P1, P2, p3;P1=m_pointColok0, p2=m_pointColok4, p3=m_pointColok5;For (int i=0; iMoveTo (ChangePoint (P1).X, ChangePoint (P1).Y);P2.x=m_pointColok4.x*cos (alpha) -m_pointColok4.y*sin (alpha);P2.y=m_pointColok4.x*sin (alpha) +m_pointColok4.y*cos (alpha);P3.x=m_pointColok5.x*cos (alpha) -m_pointColok5.y*sin (alpha);P3.y=m_pointColok5.x*sin (alpha) +m_pointColok5.y*cos (alpha);If (i%5=0)PDC-LineTo (ChangePoint (P2).X, ChangePoint (P2).Y);ElsePDC-LineTo (ChangePoint (P3).X, ChangePoint (P3).Y);PDC-SetBkMode (TRANSPARENT);CFont font;Font.CreateFont (16,12,0,0, FW_NORMAL),假,假,假,ansi_charset,out_default_precis,clip_default_precis,default_quality,default_pitch | ff_swiss,“Arial”);CFont * oldfont = PDC - SelectObject(与字体);/ /改变字体PDC - SetTextColor(RGB(255205100);PDC - TextOut(矩形。width() / 2-0.9 *(矩形。height() / 2-10)/ 2,矩形。height() / 2-5,“9”);PDC - TextOut(矩形。width() / 2 + 0.9 *(矩形。height() / 2-30)/ 2,矩形。height() / 2-5,“3”);PDC - TextOut(矩形。width() / 2-10,矩形。height() / 2-0.9 *(矩形。height() / 2-10)/ 2,“12”);PDC - TextOut(矩形。width() / 2-10,矩形。height() / 2 + 0.9 *(矩形。height() / 2-10)/ 2-10,“6”);font1 CFont;font1。CreateFont(10,8,0,0,fw_normal,假,假,假,ansi_charset,out_default_precis,clip_default_precis,default_quality,default_pitch | ff_swiss,“Arial”);PDC - SelectObject(与font1);/ /改变字体PDC - setbkcolor(RGB(255,0,0);PDC - TextOut(矩形。width() / 2-0.2 *(矩形。height() / 2-10)/ 2,矩形。height() / 2 + 0.2 *(矩形。height() / 2-10)/ 2,“redor1”);PDC - TextOut(矩形。width() / 2-0.1 *(矩形。height() / 2-10)/ 2,矩形。height() / 2-0.7 *(矩形。height() / 2-10)/ 2,“医生”);PDC - SelectObject(oldfont);/画表盘/指针P1。x = m_pointcolok 1 。X * cos(教)- m_pointcolok 1 。Y *罪(教);P1。Y = m_pointcolok 1 。X *罪(教)+ m_pointcolok 1 。Y * cos(教);P2。x = m_pointcolok 2 。X * cos(叫)- m_pointcolok 2 。Y *罪(叫);P2。Y = m_pointcolok 2 。X *罪(叫)+ m_pointcolok 2 。Y * cos(叫);P3。x = m_pointcolok 3 。X * cos(jiao3)- m_pointcolok 3 。Y *罪(
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号