文件名称:GDI Bitmap C++ Code
- 所属分类:
- GDI/图象编程
- 资源属性:
- [HTML]
- 上传时间:
- 2022-12-27
- 文件大小:
- 392.75kb
- 下载次数:
- 0次
- 提 供 者:
- khaledmagd73@gmail.com
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
#include <Windows.h>
#include <gdiplus.h>
using namespace Gdiplus;
// Forward declarations
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Initialize GDI+
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// Create the window
WNDCLASSEX wcex = { 0 };
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.hInstance = hInstance;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszClassName = L"MyWindowClass";
RegisterClassEx(&wcex);
HWND hWnd = CreateWindow(L"MyWindowClass", L"My Window", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
// Run the message loop
MSG msg = { 0 };
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// Shutdown GDI+
GdiplusShutdown(gdiplusToken);
return (int)msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// Create a Bitmap object and draw a line on it
Bitmap bmp(100, 100);
Graphics g(&bmp);
Pen pen(Color(255, 0, 0, 0)); // Red pen
g.DrawLine(&pen, 0, 0, 99, 99);
// Draw the bitmap on the window
Graphics graphics(hdc);
graphics.DrawImage(&bmp, 0, 0);
EndPaint(h
#include <gdiplus.h>
using namespace Gdiplus;
// Forward declarations
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Initialize GDI+
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// Create the window
WNDCLASSEX wcex = { 0 };
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.hInstance = hInstance;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszClassName = L"MyWindowClass";
RegisterClassEx(&wcex);
HWND hWnd = CreateWindow(L"MyWindowClass", L"My Window", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
// Run the message loop
MSG msg = { 0 };
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// Shutdown GDI+
GdiplusShutdown(gdiplusToken);
return (int)msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// Create a Bitmap object and draw a line on it
Bitmap bmp(100, 100);
Graphics g(&bmp);
Pen pen(Color(255, 0, 0, 0)); // Red pen
g.DrawLine(&pen, 0, 0, 99, 99);
// Draw the bitmap on the window
Graphics graphics(hdc);
graphics.DrawImage(&bmp, 0, 0);
EndPaint(h
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : GDI Bitmap C++ Code.rar 列表 GDI Bitmap C++ Code/GDI Bitmap C++ Code.html GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/088766228320cfd63d72d0a530e13e3e.png GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/221-198e8bdb69b09c62.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/2802bd5f-a31531b9d6706608.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/361-032f8620609ea5a4.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/400-ec71a8591468928c.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/424-7f7835d330adbaab.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/440-f9acf562f7bccc4f.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/606-9f400c2ac8262f3b.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/650-1b593574ccff91da.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/68a27ff6-21204d8ed6fd05d7.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/dde4e452-3591ea0c0fd388f8.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/fa06302711171599.css GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/framework-7a789ee31d2a7534.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/main-149b337e061b4d04.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/polyfills-c67a75d1b6f99dc8.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/saved_resource.html GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/webpack-3802b16f68ae4203.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/[[...chatId]]-4b9a792c76abb4ab.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/_app-3d9acfc3a5472af2.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/_buildManifest.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files/_ssgManifest.js.download GDI Bitmap C++ Code/GDI Bitmap C++ Code_files GDI Bitmap C++ Code