C++ Builder 6 первая программа Gdi+
C++ Builder 6 как правильно подключить Gdi+
C++ Builder 6 файл LIB которого нет где взять
Сначала качаем архив
В windows 10 - XP уже лежит файл dll в системном каталоге
В C++ Builder 6 соответствующие хидеры Gdi+ то же лежат где положено
Остается только кинуть файл lib из архива в папку lib билдера
Я хидеры и dll из архива не ставил
смотри все на фото
Самое главное Шапка (выделена синим ) а также красным
=
=
=
=
=
//---------------------------------------------------------------------------
//----- GDI+ ----------
#define STRICT
#include <windows.h>
#include <algorithm>
using std::min;
using std::max;
#pragma option -w-hid
#include <GdiPlus.h>
#pragma comment(lib, "GdiPlus.lib")
#pragma option -whid
//---------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
Gdiplus::GdiplusShutdown(gdiplusToken);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
HDC hdc= GetWindowDC( Handle );
RECT r;
SetRect(&r, Left, Top, Width, Height);
const RECT &rc= r;
// Все строки - в кодировке Unicode
WCHAR welcome[]=L"Welcome, GDI+ !";
// Создаем контекст рисования и устанавливаем
// пиксельную систему координат
Gdiplus::Graphics g( hdc );
g.SetPageUnit( Gdiplus::UnitPixel );
Gdiplus::RectF bounds( 0, 0, float(rc.right), float(rc.bottom) );
// Загружаем фоновое изображение и растягиваем его на все окно
Gdiplus::Image bg(L"BACKGRND.gif");
g.DrawImage(&bg, bounds);
// Создаем кисть с градиентом на все окно и полупрозрачностью
Gdiplus::LinearGradientBrush brush(
bounds,
Gdiplus::Color(130, 255, 0, 0),
Gdiplus::Color(255, 0, 0, 255),
Gdiplus::LinearGradientModeBackwardDiagonal );
// Готовим формат и параметры шрифта
Gdiplus::StringFormat format;
format.SetAlignment( Gdiplus::StringAlignmentCenter );
format.SetLineAlignment( Gdiplus::StringAlignmentCenter );
Gdiplus::Font font( L"Arial", 48, Gdiplus::FontStyleBold );
// Выводим текст приветствия, длина -1 означает,
// что строка заканчивается нулем
g.DrawString(welcome, -1, &font, bounds, &format, &brush);
ReleaseDC(Handle,hdc);
}
//---------------------------------------------------------------------------
=
=
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall FormPaint(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
=
|