GDI+最简单的代码,用于GDI+入门
来源:互联网 发布:windows平板游戏下载 编辑:程序博客网 时间:2024/06/06 01:47
#define UNICODE
#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;
VOID OnPaint(HDC hdc)
{
Graphics graphics(hdc);
FontFamily fontFamily(L"微软雅黑");
Font font(&fontFamily, 35, FontStyleRegular, UnitPixel);
SolidBrush solidBrush(Color(255, 0, 0, 150));
WCHAR string1[] = L"阿桀的历史程序:SingleBitPerPixel";
WCHAR string2[] = L"阿桀的历史程序:AntiAlias";
graphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
graphics.DrawString(string1, -1, &font, PointF(10.0f, 10.0f), &solidBrush);
graphics.SetTextRenderingHint(TextRenderingHintClearTypeGridFit);
graphics.DrawString(string2, -1, &font, PointF(10.0f, 60.0f), &solidBrush);
}
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, INT iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS wndClass;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
// Initialize GDI+.
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
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 = TEXT("GettingStarted");
RegisterClass(&wndClass);
hWnd = CreateWindow(
TEXT("GettingStarted"), // window class name
TEXT("Getting Started"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL); // creation parameters
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GdiplusShutdown(gdiplusToken);
return msg.wParam;
} // WinMain
LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
OnPaint(hdc);
EndPaint(hWnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
} // WndProc
#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;
VOID OnPaint(HDC hdc)
{
Graphics graphics(hdc);
FontFamily fontFamily(L"微软雅黑");
Font font(&fontFamily, 35, FontStyleRegular, UnitPixel);
SolidBrush solidBrush(Color(255, 0, 0, 150));
WCHAR string1[] = L"阿桀的历史程序:SingleBitPerPixel";
WCHAR string2[] = L"阿桀的历史程序:AntiAlias";
graphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
graphics.DrawString(string1, -1, &font, PointF(10.0f, 10.0f), &solidBrush);
graphics.SetTextRenderingHint(TextRenderingHintClearTypeGridFit);
graphics.DrawString(string2, -1, &font, PointF(10.0f, 60.0f), &solidBrush);
}
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, INT iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS wndClass;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
// Initialize GDI+.
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
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 = TEXT("GettingStarted");
RegisterClass(&wndClass);
hWnd = CreateWindow(
TEXT("GettingStarted"), // window class name
TEXT("Getting Started"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL); // creation parameters
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GdiplusShutdown(gdiplusToken);
return msg.wParam;
} // WinMain
LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
OnPaint(hdc);
EndPaint(hWnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
} // WndProc
- GDI+最简单的代码,用于GDI+入门
- 最简单的GDI+程序代码
- GDI+ 简单入门学习
- GDI&GDI+程序入门
- GDI的简单操作
- GDI+入门
- GDI+入门
- GDI+入门
- GDI+入门
- GDI+入门
- GDI+入门
- GDI GDI+ 的区别
- GDI GDI+ 的区别
- GDI+入门(Starting with GDI+)
- 简单的GDI贴图应用
- GDI绘制简单的图形
- 最简单的用于JS调试代码
- GDI+
- C#-委托和事件
- IT天才的由来
- 学习切莫望而止步
- 1、android应用开发 - ubuntu下开发环境的配置
- 解决Chrome浏览器中Flash插件崩溃的问题
- GDI+最简单的代码,用于GDI+入门
- I帧、P帧和B帧的特点
- SQL SERVER性能优化综述
- Linux设备驱动入门----I2C设备驱动
- WoguUpload1.1 - HTML5断点续传
- WIN32_FIND_DATA
- 常用的android弹出对话框
- hdu 1811Rank of Tetris (并查集+拓扑排序)
- POJ-2195-Going Home