在bcb 中如何使用gdi+????

shudingbo 2003-01-07 04:47:20
谢谢先,

如何环境配置!!
关于她的文章!
===========
最好能给一分源码!!!!
...全文
234 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
diaorenhong 2003-07-23
  • 打赏
  • 举报
回复
对不起。我来晚了。。同意搂住的。。
shudingbo 2003-01-08
  • 打赏
  • 举报
回复
up
shudingbo 2003-01-08
  • 打赏
  • 举报
回复
http://www.codeproject.com/vcpp/gdiplus/startinggdiplus.asp
guardian 2003-01-08
  • 打赏
  • 举报
回复
使用GDI+,需要有gdiplus.h,gdiplus.lib和gdiplus.dll三个文件.
gdiplus.dll文件是winXP系统中自带的,在win2k系统下是没有这个动态连接库的,你需要从winXP中拷贝过来。gdiplus.h和gdiplus.lib需要安装最新的SDK,在SDK的include目录下有着两个文件 。但是gdiplus.lib是提供给VC用的,BCB无法使用。我们需要用BCB自带的implib.exe这个工具生成供BCB使用的gdiplus.lib文件,命令如下:
implib gdiplus.lib gdiplus.dll
好了,现在只要在你的代码中#inlcude "gdiplus.H",在工程中加入gdiplus.lib就可以使用GDI+中的绘图函数了。GDI+绘图的方法和Canvas类的用法很相似。

下面是一个基于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


ThinkX 2003-01-08
  • 打赏
  • 举报
回复
elijun() 说的对,用implib生成gdiplus.dll的lib也是可以的。
ltdd 2003-01-08
  • 打赏
  • 举报
回复
BCB6已经包含了全部头文件,
手工添加 gdiplus.dll(从winxp拷一个)到系统/当前目录.
手工加入 gdiplus.lib(vs.net里有),转换一下格式.
shudingbo 2003-01-08
  • 打赏
  • 举报
回复
http://www.codeproject.com/vcpp/gdiplus/startinggdiplus.asp
shudingbo 2003-01-07
  • 打赏
  • 举报
回复
行,但是我不知道怎么做!
Gdi+是相对独立的!
Format_CIH 2003-01-07
  • 打赏
  • 举报
回复
不行吧,BCB不支持.net
shudingbo 2003-01-07
  • 打赏
  • 举报
回复
没言语!
耙子 2003-01-07
  • 打赏
  • 举报
回复
啥叫GDI+ ?
wangxd 2003-01-07
  • 打赏
  • 举报
回复
帮你up

13,824

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧