怎么在Win32 Application程序中使用GDI+ 现在从网上下了一个GDIplus的文件夹,里面有Include和lib 还有一个gdiplus.dll文件 在VC6.0的Win32 Application中怎么用?高手赐教下 谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 包含h,link lib文件,然后dll放到工程目录,就可以调用h中的函数了 能说详细点吗?怎么包含H?怎么link lib DLL放到哪里?谢谢~ 下面是一个基于Win32 SDK的窗口程序。使用要包含GDIplus.h头文件,连接设置要包含GdiPlus.lib库文件。 #define UNICODE #include #include using namespace Gdiplus; void OnPaint(HWND hWnd) { HDC hdc; PAINTSTRUCT ps; hdc = BeginPaint(hWnd, &ps); Graphics graphics(hdc); Pen pen(Color(255, 0, 0, 255)); graphics.DrawLine(&pen, 0, 0, 200, 100); EndPaint(hWnd, &ps); } // OnPaint LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR szCmdLine, int iCmdShow) { HWND hWnd; MSG msg; WNDCLASS wndClass; GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; // 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); 关闭GDI+ return msg.wParam; } // WinMain LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_PAINT: OnPaint(hWnd); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProc(hWnd, message, wParam, lParam); } } // WndProc 原来我的SDK 中没有ULONG_PTR的定义 晕 谢谢佳宁 朋友 接分 最牛的弹出窗口过滤 如何使用_RecordsetPtr作函数参数? 砸锅卖铁跪求大家告知 问一下,批处理的时候怎么读入文件?请大家来帮我看看 给zangyong(晶晶)的500分,第一贴 一个关于使用ATL的问题 组件中自定义结构编译的问题 发点牢骚:VC是良种马,BCB是杂种马! 如何得到kernel,user等windows系统核心模块的句柄? 怎样编程屏蔽掉WIN,APP两个快捷键? CListBox Addstring()无法显示 求教 请问在MDI程序中,如何通过代码而不是对话框打开新文件?
怎么包含H?怎么link lib DLL放到哪里?
谢谢~
#define UNICODE
#include
#include
using namespace Gdiplus; void OnPaint(HWND hWnd)
{
HDC hdc;
PAINTSTRUCT ps; hdc = BeginPaint(hWnd, &ps); Graphics graphics(hdc);
Pen pen(Color(255, 0, 0, 255)); graphics.DrawLine(&pen, 0, 0, 200, 100); EndPaint(hWnd, &ps); } // OnPaint LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE,
PSTR szCmdLine, int iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS wndClass;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken; // 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); 关闭GDI+ return msg.wParam; } // WinMain LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
OnPaint(hWnd);
return 0; case WM_DESTROY:
PostQuitMessage(0);
return 0; default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
} // WndProc