1.用C语言画一个哆啦A梦_附源码
用C语言画一个哆啦A梦_附源码
// 通过C语言与Windows API,源码源码成功绘制出哆啦A梦的创梦图像,并附上源代码示例。官网手机 人脸识别源码
以下是源码源码用于实现这一目标的代码:
c
#include
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
static TCHAR szAppName[] = TEXT("MyWindows");
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
// 窗口风格设置
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
if (!RegisterClass(&wndclass)) {
MessageBox(NULL, TEXT("这个程序需要在 Windows NT 才能执行!"),创梦影片充值app源码 szAppName, MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(szAppName, TEXT("Windows"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
HPEN hBlackPen, hOldPen, hWhite2Pen;
HBRUSH hWhiteBrush, hOldBrush, hBlackBrush, hRedBrush, hYellowBrush;
static HBRUSH hBlueBrush, blue_brush, green_brush;
static HPEN hBlue3Pen, blue_pen, green_pen;
POINT pxRightHand[4], pxiLeftHand[4];
int xCursor, yCursor;
POINT point;
switch (message) {
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
// 在窗口上写字
Rectangle(hdc, rect.right / 2 - , 5, rect.right / 2 - , );
Rectangle(hdc, rect.right / 2 + , 5, rect.right / 2 + , );
TextOut(hdc, rect.right/2 -, , L"画蓝色哆啦A梦", 7);
TextOut(hdc, rect.right/2 + , , L"画绿色哆啦A梦", 7);
// 绘制哆啦A梦各个部位
// 绘制头部、脸、官网qt4.8源码眼睛、源码源码瞳孔、创梦鼻子、官网嘴巴、源码源码胡子、创梦身体、官网肚子、源码源码c语言 free源码项圈、创梦铃铛、官网响应式文章源码百宝袋、腿、脚掌、手臂与手掌等细节
// 绘制哆啦A梦的整体结构与细节
// 绘制哆啦A梦的各个部分
// 结束绘制
EndPaint(hwnd, &ps);
break;
// 其他消息处理
// 更多消息处理逻辑
}
return 0;
}