⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadbmp.c

📁 44b0处理器+UCOS操作系统+miniGUI源代码
💻 C
字号:
/* ** $Id: loadbmp.c,v 1.4 2003/06/13 06:50:39 weiym Exp $**** loadbmp.c: Sample program for MiniGUI Programming Guide**         Load and display a bitmap.**** Copyright (C) 2003 Feynman Software.**** License: GPL*/#include <stdio.h>#include <stdlib.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>static BITMAP bmp;static int LoadBmpWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){    HDC hdc;    switch (message) {        case MSG_CREATE:            if (LoadBitmap (HDC_SCREEN, &bmp, "bkgnd.bmp")) {              return -1;            	}            return 0;        case MSG_PAINT:            hdc = BeginPaint (hWnd);            FillBoxWithBitmap (hdc, 0, 0, 100, 100, &bmp);            Rectangle (hdc, 0, 0, 100, 100);            FillBoxWithBitmap (hdc, 100, 0, 200, 200, &bmp);            Rectangle (hdc, 100, 0, 300, 200);            FillBoxWithBitmapPart (hdc, 0, 200, 400, 200, 0, 0, &bmp, 10, 10);            Rectangle (hdc, 0, 200, 400, 400);            EndPaint (hWnd, hdc);            return 0;        case MSG_CLOSE:            UnloadBitmap (&bmp);            DestroyMainWindow (hWnd);            PostQuitMessage (hWnd);            return 0;    }    return DefaultMainWinProc(hWnd, message, wParam, lParam);}int MiniGUIMain (int argc, const char* argv[]){    MSG Msg;    HWND hMainWnd;    MAINWINCREATE CreateInfo;#ifdef _LITE_VERSION    SetDesktopRect(0, 0, 1024, 768);#endif        CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;    CreateInfo.dwExStyle = WS_EX_NONE;    CreateInfo.spCaption = "Load and display a bitmap";    CreateInfo.hMenu = 0;    CreateInfo.hCursor = GetSystemCursor(0);    CreateInfo.hIcon = 0;    CreateInfo.MainWindowProc = LoadBmpWinProc;    CreateInfo.lx = 0;    CreateInfo.ty = 0;    CreateInfo.rx = 430;    CreateInfo.by = 420;    CreateInfo.iBkColor = PIXEL_lightwhite;    CreateInfo.dwAddData = 0;    CreateInfo.hHosting = HWND_DESKTOP;        hMainWnd = CreateMainWindow (&CreateInfo);        if (hMainWnd == HWND_INVALID)        return -1;    ShowWindow (hMainWnd, SW_SHOWNORMAL);    while (GetMessage(&Msg, hMainWnd)) {        TranslateMessage(&Msg);        DispatchMessage(&Msg);    }    MainWindowThreadCleanup (hMainWnd);    return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -