自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (1)
  • 问答 (1)
  • 收藏
  • 关注

空空如也

旋转圆形重绘

有点小问题,颜色不能交替变换 #include<windows.h> #include<stdio.h> #include<math.h> LRESULT CALLBACK WinProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { //定义一个窗口类 WNDCLASS wincls; wincls.cbClsExtra=0; wincls.cbWndExtra=0; wincls.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); wincls.hCursor=LoadCursor(NULL,IDC_CROSS); wincls.hIcon=LoadIcon(NULL,IDI_ERROR); wincls.lpfnWndProc=WinProc; wincls.lpszClassName="Lucky_wei"; wincls.lpszMenuName=NULL; wincls.hInstance=hInstance; wincls.style=CS_HREDRAW | CS_VREDRAW; if(!RegisterClass(&wincls;)) { MessageBox(NULL,"窗口类注册失败","注册窗口",NULL); return 1; } // //创建窗口 ,定义一个变量用来保存成功建立的窗口的句柄 HWND hwnd; hwnd=CreateWindow("Lucky_wei","旋转小风车",WS_OVERLAPPEDWINDOW,0,0,600,600,NULL,NULL,hInstance,NULL); if(!hwnd) { MessageBox(NULL,"创建窗口失败","创建窗口",NULL); return 1; } // // //显示并更新窗口 ShowWindow(hwnd,SW_SHOWNORMAL); UpdateWindow(hwnd); // // //定义消息结构体,实现消息循环 MSG msg; while(GetMessage(&msg;,NULL,0,0)) { TranslateMessage(&msg;); DispatchMessage(&msg;); } return msg.wParam; } // // // //编写窗口过程函数 LRESULT CALLBACK WinProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { int xogr,yogr,a,b,i; float xbegin[3],ybegin[3],xend[3],yend[3]; HDC hDC; PAINTSTRUCT ps; HBRUSH hBrush; HPEN hPen; RECT clientRect; COLORREF color[4]={RGB(255,0,0),RGB(0,255,0),RGB(0,0,255),RGB(255,255,255)}; int BrushStyle[3]={BLACK_BRUSH,GRAY_BRUSH,WHITE_BRUSH}; switch(uMsg) { case WM_PAINT: hDC=BeginPaint(hwnd,&ps;); GetClientRect(hwnd,&clientRect;); xogr=clientRect.left+100; yogr=clientRect.top+100; a=xogr+200; b=yogr+200; xbegin[0]=400; xbegin[1]=400-100*2.732; xbegin[2]=xbegin[1]; ybegin[0]=b-100; ybegin[1]=yogr; ybegin[2]=400; xend[0]=xbegin[1]; xend[1]=xbegin[2]; xend[2]=xbegin[0]; yend[0]=ybegin[1]; yend[1]=ybegin[2]; yend[2]=ybegin[0]; for(i=0;i<3;i++) { SelectObject(hDC,hPen); hBrush=CreateSolidBrush(color[i]); SelectObject(hDC,hBrush); Pie(hDC,xogr,yogr,a,b,xbegin[i],ybegin[i],xend[i],yend[i]); Sleep(100); } InvalidateRect(hwnd,NULL,1); DeleteObject(hPen); DeleteObject(hBrush); EndPaint(hwnd,&ps;); break; case WM_TIMER: if(wParam==1111) InvalidateRect(hwnd,NULL,1); break; case WM_CLOSE: if(IDYES==MessageBox(hwnd,"是否真的结束?","message",MB_YESNO)) { DestroyWindow(hwnd); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd,uMsg,wParam,lParam); break; } return 0; }

2012-05-14

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除