| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 515 人关注过本帖
标题:请不啬赐教!图画不出来!
只看楼主 加入收藏
huangtian
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-10-10
收藏
 问题点数:0 回复次数:2 
请不啬赐教!图画不出来!

#include<windows.h>
#include<stdlib.h>
#include<string.h>

long WINAPI WndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam);
BOOL InitWindowsClass(HINSTANCE hInstance);
BOOL InitWindows(HINSTANCE hInstance,int nCmdShow);
HWND hWndMain;

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
MSG Message;
if(!InitWindowsClass(hInstance))
return FALSE;
if(!InitWindows(hInstance,nCmdShow))
return FALSE;
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}

long WINAPI WndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam)
{
HDC hDC;
HBRUSH hBrush;
HPEN hPen;
PAINTSTRUCT PtStr; //定义指向包含绘图信息的结构体变量
switch(message)
{
case WM_PAINT:
hDC=BeginPaint(hWnd,&PtStr);
SetMapMode(hDC,MM_ANISOTROPIC);
hPen=(HPEN)GetStockObject(BLACK_PEN);
hBrush=(HBRUSH)GetStockObject(DKGRAY_BRUSH);
SelectObject(hDC,hBrush);
SelectObject(hDC,hPen);
RoundRect(hDC,50,120,100,200,15,15);
hBrush=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
SelectObject(hDC,hBrush);
Ellipse(hDC,150,50,200,150);
hBrush=(HBRUSH)GetStockObject(HOLLOW_BRUSH);
SelectObject(hDC,hBrush);
Pie(hDC,250,50,300,100,250,50,300,50);
EndPaint(hWnd,&PtStr);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
}

BOOL InitWindows(HINSTANCE hInstance,int nCmdShow)
{
HWND hWnd;
hWnd=CreateWindow(
"WindFill",
"填充示例程序",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);
if(!hWnd)
return FALSE;
hWndMain=hWnd;
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}

BOOL InitWindowClass(HINSTANCE hInstance)
{
WNDCLASS WndClass;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=LoadIcon(NULL,"END");
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=WndProc;
WndClass.lpszClassName="WinFill";
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW | CS_VREDRAW;
return RegisterClass(& WndClass);
}


搜索更多相关主题的帖子: 图画 
2006-10-23 02:24
radcat
Rank: 3Rank: 3
等 级:论坛游民
威 望:8
帖 子:306
专家分:45
注 册:2006-9-12
收藏
得分:0 
long WINAPI WndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam);这句对吗?
这个框架好像就有问题

2006-10-23 10:38
长安之星
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-10-27
收藏
得分:0 

在EndPaint后加上
Sleep(1000);
InvalidateRect(hWnd,NULL,1);\\刷新~~~~

2006-11-02 09:25
快速回复:请不啬赐教!图画不出来!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018442 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved