//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "OnPaint.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPaint(TObject *Sender)
{
Form1->WindowState = wsMaximized; // amplia a janela
Graphics::TBitmap *Bitmap; // declara Bitmap
TRect ARect, A2Rect; // declara
ARect = Rect( 0, 0, 600, 300 ); // inicializa ARect determinado as coordenadas
Bitmap = new Graphics::TBitmap; // alocação dinâmica de memória para Bitmap
Bitmap->LoadFromFile("c:\\céu.bmp"); // carrega o arquivo especificado
// BrushCopy carregará o desenho substituindo as cores negras do mesmo
Form1->Canvas->BrushCopy(ARect, Bitmap, ARect, clBlack);
// desaloca a memória dinâmica
delete Bitmap;
Label1 -> Caption = "Abrindo imagem com canvas";
Canvas->Font->Size = 20;
Canvas->Font->Color = clBlack;
Canvas->TextOut ( 200, 160, "Por: " );
Canvas->Font->Color = clRed;
Canvas->TextOut ( 260, 160, "Samuel Lima");
Canvas->Font->Color = clBlack;
Canvas->TextOut ( 200, 197, "sa_sp10@hotmail.com");
Canvas->Font->Name = "Garamond";
Canvas->Font->Size = 40;
Canvas->Font->Color = clSkyBlue;
Canvas->TextOut ( 76, 236, "MUITO OBRIGADO");
SetBkMode(Canvas->Handle, TRANSPARENT);
Canvas->Font->Color = clBlue;
Canvas->TextOut ( 70, 230, "MUITO OBRIGADO");
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef OnPaintH
#define OnPaintH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TShape *Shape1;
TLabel *Label1;
void __fastcall OnPaint(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
object Form1: TForm1
Left = 342
Top = 219
HorzScrollBar.Color = clWhite
HorzScrollBar.ParentColor = False
Caption = 'Abrindo imagem com canvas'
ClientHeight = 300
ClientWidth = 600
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poDesigned
OnPaint = OnPaint
PixelsPerInch = 96
TextHeight = 13
object Shape1: TShape
Left = 0
Top = 0
Width = 601
Height = 297
Brush.Style = bsClear
Pen.Width = 10
Shape = stRoundRect
end
object Label1: TLabel
Left = 120
Top = 22
Width = 10
Height = 39
Color = clWhite
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -32
Font.Name = 'Tahoma'
Font.Style = []
ParentColor = False
ParentFont = False
end
end
Nenhum comentário:
Postar um comentário
Observação: somente um membro deste blog pode postar um comentário.