Воскресенье, 05.05.2024, 11:26
Главная Регистрация RSS
Приветствую Вас, Гость
Меню сайта
Категории раздела
Форма входа
ДРУЗЬЯ САЙТА

Вызвать мастера в Красноярске

8 983 207 5474

8 902 918 9334

8 933 332 3164

---------------------------------

Запчасти бытткхники

  • Велес т.2935600
  • СЦ Близнецов т.2296595
  • Вираж
  • Красраб 110 т.2589503
  • Комплекстур Щорса30 т.2606797
  • Радиодетали

  • Якорный 9 т.2688317
  • Воронова 16 т.2202990
  • Красраб 125а т.2456544
  • Профи т.2702737
  • Дайте две т.+79237713323
  • Электрика

  • Электро +
  • Планета электрика
  • ЗАКЛАДКИ
    Поиск
    Статистика

    Онлайн всего: 1
    Гостей: 1
    Пользователей: 0
    Главная » Статьи » C++ Builder » Простые примеры

    C++ Builder 6 первая программа Gdi+

    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

    =

    Категория: Простые примеры | Добавил: doka (30.10.2020)
    Просмотров: 581 | Рейтинг: 0.0/0
    Добавлять комментарии могут только зарегистрированные пользователи.
    [ Регистрация | Вход ]