//---------------------------------------------------------------------------
#define STRICT // 여기 넣기 싫으면 프로젝트 옵션의 conditions에 넣어주면 됨.
#include <vcl.h>
#pragma hdrstop
#include <algorithm>
namespace Gdiplus
{
using std::min;
using std::max;
}
#include <gdiplus.h>
using namespace Gdiplus;
namespace gdp = Gdiplus;
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma link "gdiplus.lib" // 이거 넣어야 됩니다.
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
ULONG_PTR gdpToken;
GdiplusStartupInput gdpSI;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
VOID PaintEx(HDC hdc)
{
gdp::Graphics gp(hdc);
gp.SetSmoothingMode(SmoothingModeAntiAlias);
Pen pen(Color(255, 0, 0, 255));
gp.DrawLine(&pen, 0, 0, 200, 100);
gp.DrawLine(&pen, 0, 0, 300, 10);
gp.DrawEllipse(&pen, 10, 10, 200, 200);
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
if (GdiplusStartup(&gdpToken, &gdpSI, NULL) != gdp::Ok)
{
// init error.
}
// ex.
PaintEx(Image1->Canvas->Handle);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
GdiplusShutdown(gdpToken);
}
//---------------------------------------------------------------------------
그냥 필요할때 찾는 시간 절약용입니다.
예전에 올려 놓은 자료가 깨져 있어서 오늘 다시 실험해서 올립니다.
필요한 파일은 동봉했습니다.
GDI+ 파일중 DLL과 LIB는
동봉한 것을 쓰고
C++Builder내에 이미 GDI+ 헤더 파일을 포함하고 있으니
그걸 그냥 써도 됩니다.
동봉한 것은 좀더 나은 버전입니다.
정확한 버전 확인은 시간 관계상 패스. ㅡㅡ;
설명은 코드만 봐도 누구나 알수 있어 그것도 패스. ㅡㅡ;
|