91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 40KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-08
  • 語言: C/C++
  • 標簽: C語言??時鐘轉動??

資源簡介

C語言 課程設計 模擬時鐘轉動程序 及其代碼

資源截圖

代碼片段和文件信息


#include
#include
#define?TWOPI?(2*3.14159)
#define?IDTIMER?1
#define?ANGLE?TWOPI/360
LRESULT?CALLBACK?WindowProc(HWND?hwndUINT?uMsg?WPARAM?wParamLPARAM?lParam?);
int?WINAPI?WinMain(HINSTANCE?hInstanceHINSTANCE?hPrevInstance?LPSTR?lpCmdLineint?nCmdShow?)
{
?TCHAR?szClassName[]?=?TEXT(“analogCloc“);
?MSG?msg;
?HWND?hwnd;
?WNDCLASS?wndclass;
?wndclass.cbClsExtra?=?0;
?wndclass.cbWndExtra?=?0;
?wndclass.hbrBackground?=?(HBRUSH)::GetStockobject(WHITE_BRUSH);
?wndclass.hCursor?=?NULL;
?wndclass.hIcon?=?NULL;
?wndclass.hInstance?=?hInstance;
?wndclass.lpfnWndProc?=?WindowProc;
?wndclass.lpszClassName?=?szClassName;
?wndclass.lpszMenuName?=?NULL;
?wndclass.style?=?CS_HREDRAW?|?CS_VREDRAW?;
?RegisterClass(&wndclass);
?hwnd?=?CreateWindow(szClassNameTEXT(“Clock“)WS_OVERLAPPEDWINDOW
???CW_USEDEFAULTCW_USEDEFAULT
????????????CW_USEDEFAULTCW_USEDEFAULT
???NULL?NULL?hInstance?NULL);
?ShowWindow(hwndnCmdShow);
?????UpdateWindow(hwnd);
?while(GetMessage(&msgNULL00))?
?{
??TranslateMessage(&msg);
??DispatchMessage(&msg);
?}
?return?msg.wParam;
}
void?setISOTROPIC(HDC?hdcint?cxClientint?cyClient)//設置映射模式使之成為笛卡爾坐標系的映射模式
{
?SetMapMode(hdcMM_ISOTROPIC);
?SetWindowExtEx(hdc10001000NULL);???//?邏輯單位與設備單位比1/2
?SetViewportExtEx(hdccxClient/2-cyClient/2NULL);
?SetViewportOrgEx(hdccxClient/2cyClient/2NULL);?????//?豎坐標向上為正,下為負
}
void?drawClock(HDC?hdc)
{
?int?x?y?radius;???
?Selectobject(hdcCreateSolidBrush(RGB(1148138)));
?for(int?i=0;i<360;i+=6)
?{
??x?=?(int)(cos(TWOPI/360*i)*900);
??y?=?(int)(sin(TWOPI/360*i)*900);
??radius?=?!(i%5)?40:10;
??Ellipse(hdcx-radiusy-radiusx+radiusy+radius);
?}
}
void?drawHands(HDC?hdcSYSTEMTIME?*pstBOOL?hChange)
{
?int?radius[3]?=?{500700850};?
?int?angle[3];??
?angle[0]?=?pst->wHour*30+pst->wMinute/12*6;????
?angle[1]?=?pst->wMinute*6;
?angle[2]?=?pst->wSecond*6;
?for(int?i=hChange?0:2;i<3;i++)
?{
??MoveToEx(hdc00NULL);
??LineTo(hdc(int)(radius[i]*cos(ANGLE*(90-angle[i])))
?????????(int)(radius[i]*sin(ANGLE*(90-angle[i]))));
?}
}
LRESULT?CALLBACK?WindowProc(
????HWND?hwnd???
????UINT?message?
????WPARAM?wParam?
????LPARAM?lParam??

{
?TCHAR?time[40];
?PAINTSTRUCT?ps;
?HDC?hdc;
?static?int?cxClient?cyClient;
?SYSTEMTIME?st;
?static?SYSTEMTIME?preSt;
?BOOL?hChange;
?switch(message)
?{
??case?WM_CREATE:
??::SetTimer(hwndIDTIMER1000NULL);
??::GetLocalTime(&st);
??wsprintf(timeTEXT(“%d年%d月%d日%d時%d分%d秒“)
???????st.wYear
???????st.wMonth
???????st.wDay
???????st.wHour
???????st.wMinute
???????st.wSecond);
??SetWindowText(hwndtime);
??preSt?=?st;
??return?0;
?????case?WM_SIZE:
??cxClient?=?LOWORD(lParam);
??cyClient?=?HIWORD(lParam);
??return?0;
??case?WM_TIMER:
??::GetLocalTime(&st);??//每次都要獲取當前時間
??hChange?=?st.wHour!=preSt.wHour||st.wMinute!=preSt.wMinute;
??hdc?=?GetDC(hwnd);
??setISOTROPIC(hdccxClientcyClient);
??::Selectobject(hdc::GetStockobject(

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-12-29?18:07??新建文件夾\
?????文件????????3844??2011-06-15?22:04??新建文件夾\模擬時鐘.cpp
?????文件??????180280??2011-06-15?22:04??新建文件夾\模擬時鐘.exe

評論

共有 條評論