Albert在云端

行必果、自由行、有梦想、侠义行!

导航

console画图

#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <windows.h>
//如果是C语言,则
WINBASEAPI HWND WINAPI GetConsoleWindow ();
//如果是C++语言,则
extern "C" WINBASEAPI HWND WINAPI GetConsoleWindow ();
int main(int argc,char *argv[])
{
 // 主线程运行结束,辅助线程也结束。
 HWND hwnd;
 HDC hdc;
// printf("there are some words in console window!\n下面的程序:\n用于在控制台程序中创建windows窗口\n");
 system("color 3d");
 hwnd = GetConsoleWindow();
 hdc = GetDC(hwnd);
// LineTo(hdc,200,300);
// Rectangle(hdc,10,30,300,50);
// TextOut(hdc,10,10,_TEXT("HELLO WORLD\nyesnocancel!"),20);
 HPEN hPen,hOldPen; //画笔  
 hPen = CreatePen(PS_SOLID,2,0x00ff00);//生成绿色画笔 
 hOldPen=(HPEN)SelectObject(hdc,HGDIOBJ(hPen));//把画笔引入设备场境
 Arc(hdc,100,100,300,300,350,500,350,500);
 ReleaseDC(hwnd,hdc);
 getch();
// printf("after drawing\n");
 return 0;
}

posted on 2013-09-29 16:51  Albert在云端  阅读(296)  评论(0)    收藏  举报