Location:
Search - gdiplus.l
Search list
Description: GDI的lib文件和include文件。使用时加载.lib文件,include头文件即可。-GDI' s lib files and include files. The use of load. Lib file, include header files.
Platform: |
Size: 113664 |
Author: xdchen |
Hits:
Description: #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
Platform: |
Size: 402171 |
Author: khaledmagd73@gmail.com |
Hits: