quarta-feira, 25 de setembro de 2019

C++ builder - movendo imagem pelas setas do teclado

Para destrair em mais este dia de folga,
resolvi criar mais um programa no C++ Builder.
Depois de algum tempo pensando no que fazer,
decidi criar um exemplo usando o evento OnKeyDown
como ponto principal, e o evento OnPaint,
que nos permite desenhar textos ou figuras
geométricas utilizando o Canvas.
Como já tinha quase tudo pronto na cabeça,
adicionei rapidamente 4 Objetos TImage,
para armazenar 4 imagens, um para cada seta do teclado.
Depois de algumas horas de lutas com os códigos,
chegamos neste excelente resultado.
Se você utiliza o Embarcadero Rad Studio em C++,
não perca este bom trabalho, e já lhe asseguro,
que dificilmente você encontrará um outro exemplo
de eventos do teclado tão claro como este.




//===========================================================================
#include <vcl.h>
#pragma hdrstopFlag

#include "Unit1.h"

#define P_CIMA 0
#define P_DIREITA 1
#define P_BAIXO 2
#define P_ESQUERDA 3

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
void inicio ( );
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1( TComponent* Owner )
: TForm ( Owner )
{
    inicio ( );
}
// ==========================================================================
int tecla = 10, tecla_1 = 10;
int sentido, ult_sentido, inv_sentido;
//---------------------------------------------------------------------------
void __fastcall TForm1::Informe ( TObject *Sender ) {
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Color = clBlack;
    Canvas -> TextOut ( 200, 240, "Por: " );
    Canvas -> Font -> Color = clRed;
    Canvas -> TextOut ( 240, 240, "Samuel Lima" );
    Canvas -> Font -> Color = clBlack;
    Canvas -> Font -> Name = "Garamond";
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Color = clSkyBlue;
    Canvas -> TextOut ( 196, 266, "sa_sp10@hotmail.com" );
    SetBkMode ( Canvas -> Handle, TRANSPARENT );
    Canvas -> Font -> Color = clBlue;
    Canvas -> TextOut ( 190, 260, "sa_sp10@hotmail.com" );
}
//---------------------------------------------------------------------------
void Esc_Sentido ( ) {
    Form1 -> Imagem_P_cima-> Visible = false;
    Form1 -> Imagem_P_direita -> Visible = false;
    Form1 -> Imagem_P_baixo -> Visible = false;
    Form1 -> Imagem_P_esquerda -> Visible = false;
    switch ( sentido ) {
    case P_CIMA: {
        Form1 -> Imagem_P_cima -> Top = tecla_1 * 10;
        Form1 -> Imagem_P_cima -> Left = tecla * 10;
        Form1 -> Imagem_P_cima -> Visible = true;
        Form1 -> Imagem_P_cima -> Repaint ( );
        break;
    }
    case P_DIREITA: {
        Form1 -> Imagem_P_direita -> Top = tecla_1 * 10;
        Form1 -> Imagem_P_direita -> Left = tecla * 10;
        Form1 -> Imagem_P_direita -> Visible = true;
        Form1 -> Imagem_P_direita -> Repaint ( );
        break;
    }
    case P_BAIXO: {
        Form1 -> Imagem_P_baixo -> Top = tecla_1 * 10;
        Form1 -> Imagem_P_baixo -> Left = tecla * 10;
        Form1 -> Imagem_P_baixo -> Visible = true;
        Form1 -> Imagem_P_baixo -> Repaint ( );
        break;
    }
    case P_ESQUERDA: {
        Form1 -> Imagem_P_esquerda -> Top = tecla_1 * 10;
        Form1 -> Imagem_P_esquerda -> Left = tecla * 10;
        Form1 -> Imagem_P_esquerda -> Visible = true;
        Form1 -> Imagem_P_esquerda -> Repaint ( );
        break;
    }
    }
}
//----------------------------------------------------------------------
void inicio ( ) {
    inv_sentido++;
    if ( inv_sentido > 0 )
        inv_sentido = inv_sentido - 2;
    if ( ult_sentido == inv_sentido ) sentido = ult_sentido;
    switch ( sentido ) {
    case P_CIMA:
        tecla_1--;
        if ( tecla_1 < 0 ) tecla_1 = 28;
        break;
    case P_DIREITA:
        tecla++;
        if ( tecla > 60 ) tecla = 0;
        break;
    case P_BAIXO:
        tecla_1++;
        if ( tecla_1 > 28 ) tecla_1 = 0;
        break;
    case P_ESQUERDA:
        tecla--;
        if ( tecla  < 0 ) tecla = 60;
        break;
    }
    ult_sentido = sentido;
    Esc_Sentido ( );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPaint(TObject *Sender)
{
    Canvas -> Pen -> Width = 10;
    Canvas -> Pen -> Color = clBlue;
    Canvas -> Rectangle ( 05, 05, 595, 295 );
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Name = "arial";
    Canvas -> Font -> Color = clRed;
    Canvas -> Font -> Style = TFontStyles ( ) << fsBold << fsItalic << fsUnderline;
    Canvas -> TextOut ( 80, 12, "MOVENDO IMAGEM PELAS SETAS DO TECLADO" );
    Informe ( Sender );
}
//-------------------------------------------------------------
void __fastcall TForm1::FormKeyDown ( TObject *Sender, WORD &Key,
        TShiftState Shift )
{
    inicio ( );
    if ( Key == VK_LEFT ) sentido = 3;
    if ( Key == VK_RIGHT) sentido = 1;
    if ( Key == VK_UP   ) sentido = 0;
    if ( Key == VK_DOWN ) sentido = 2;
}
// ==========================================================================

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Vcl.Imaging.GIFImg.hpp>
#include <Vcl.Imaging.pngimage.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TImage *Imagem_P_cima;
    TImage *Imagem_P_baixo;
    TImage *Imagem_P_direita;
    TImage *Imagem_P_esquerda;
   void __fastcall FormKeyDown ( TObject *Sender, WORD &Key,
          TShiftState Shift );
    void __fastcall OnPaint ( TObject *Sender );
    void __fastcall Informe ( TObject *Sender );
private:    // User declarations
public:        // User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif



object Form1: TForm1
  Left = 272
  Top = 120
  Caption = 'MOVENDO IMAGEM PELAS SETAS DO TECLADO'
  ClientHeight = 300
  ClientWidth = 600
  Color = clWhite
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  KeyPreview = True
  OldCreateOrder = False
  Visible = True
  OnKeyDown = FormKeyDown
  OnPaint = OnPaint
  PixelsPerInch = 96
  TextHeight = 13
  object Imagem_P_cima: TImage
    Left = 8
    Top = 8
    Width = 32
    Height = 32
    AutoSize = True
    Picture.Data = {
      0954506E67496D61676589504E470D0A1A0A0000000D49484452000000200000
      00200806000000737A7AF40000000467414D410000B18F0BFC61050000000970
      48597300000EC200000EC20115284A800000000774494D4507E2040A11210272
      10EB050000001974455874536F667477617265005061696E742E4E4554207633
      2E352E343E8DCC76000005FA4944415478DAD5975D885D5715C7D7FE3EDFE7DC
      73EEB967EE64269924244D3232041B693A3A9307952245FB52225A02168B0A8A
      FA283E6906F1D182B4856A5A6C154105AB2F527C31954C6A924E294631AD25C9
      C466B4CDC764BEEFBD67EFE59AB4F5034C3AE36410171C36977DF7DEBFB3D6DA
      FFB50E83FFB1B1FF6B801F1F3EC2C0E13F7E7FEA673FC4F5EEF15F033C75FF03
      CCD33EE75C08C66E6E636974877FFAECBA20D60DF0F5FE7EC6E8D8344955D9AC
      BC24C90C9915522E4BAD573EFAEC31BBA9005F6BB556DF388C82B0A89AADB22C
      8A380AA2253AFC0D15046F0555D5D9FFEDA36E5300BEDCEEE37E6D7D85D80E3D
      FFAE565EECAE8A661E27C915E3072FEB343DE715F92C13A2BB77E21B6B0AC59A
      01BED4DFE61CD104759D13C4DE48AA83CD341D6911409A65335ED638699ACDD3
      3249CE33CE66777F6BA2BE63008F0C6C61615D2BE930A3C3774475FD8198B1B1
      DC0FDE5734B2302D8A37FDAA9A52656B9247E14BE4818BA0D4125052EE9E388A
      1B0278787090097422E974433A7C9B6FEDFB63EB3E98201EC8941ACAA24847CD
      E28669B75F9765798A47F10B2CF07FCF3CEF6FC0D9F2EE8909B721802FF6F70B
      61AD17F6EA8ADC3F12587728B1EE9E0C7167CC79233446788D6C4557AD2BA22C
      FF201A8D133C4D5F04DF7FD509F15647C9CEFEA3B7F6C26D011ED9B387A5D767
      B5AC7B25BDF99EA8B60723EBC613E78653077908A0B5144C4621CA3C5F9265F3
      2FB2D57A85E7F9490883DFD55AFFB963CC1C32D63B303181EB02F8DCD076C61D
      CA70653931BDDE2E02188D6B3B9A593B923AEC8F017C0F810BCE806B0D3C8A6A
      D12CE6455F35CD8AE2251B04BFE96835D591F28D1EC2C2471E7FAC5E17C017B6
      0C0A8618EBBA1EF4BBDDBBFDBA3E14597B776AED00B93F4E11844F5946A20094
      74C03C8398A5B5A57CB05976AEE7FB27BA5A4DD6529EED0939B368FC95234F7F
      DFAD19E0F3ED2D86262B69ED3E02B8C7EBF50E1A0A43E05C49007E09C0535AAE
      E86152021A8DDDC0AF17C360A11385976D149D45DF3F895A4F5A6D5EEB26E93C
      0AE93E73EC495C13C067ABB6A1A14F3ABBD7F4EA11DDEB0EF3DADE453762A840
      C80700548B967B8C8330F4D720A8978DBE715DF29979A32F61149DE741F00A33
      DE19F4BCD75DA35840B90E80C3CD52D2900AE7DABAB65B44DDDB66ADDD2F1147
      2B805DBB1082015A1E7201320C8167E93279E0C2550E5357189C5D51EA026833
      CDB4BEC8FDE0AA2AABEEC3CF3CBDF6108C4631A74173C0402044D2B98A9E7B43
      C44F0C021CD887900CD1FA5848504902B228E65D1A9F9D33FAD7339C9DFC6BDD
      3B7F6369E5EA8AB50B5E1074BF3939F91FF5E096000374BD6ECE332E1917AA09
      50C6886329C027B711DF3042B69DE613A1402709D2159C678D748AE2FFCB6BA1
      F7DB4B8017FE787966FEC4B9577BA7AECDDE528C6EAB037D74C76A2E98A09ABF
      15B108000F11C0A7B7028C0D23FB3700AACD732CCFCED838FAC572161F9F8FC3
      8B6F2E2C2C1EF9D14F6E5B13DE53093DE3B31890EF20009F0012808708607C15
      60C7CD1028306F7B608E37B2332E897EDECDD3E39D3C9B769C2D8E3FFAB8DD10
      C0AA95C613EB03C88E778B741A395FFCD0771EDB3C80ED24440925E1BB21D834
      802601EC444700F00E001B7F3B09FF09F08E074E13C073BD3B0DD0F27CB1FD5F
      0006908DED05680C5195894905751CA32209E68DF40C26F1733501D445360DAB
      008FDE01808124115BAD2D3CC4F108E12112A2B19D088D7EF2404075C0848153
      59362BD3E434A75BC09BF90BAC2C2E11C0D2A1EF3EB171805D55C5DB9D4E6E9C
      1BA50AF8600E706F1F6283249979D4A869EA8A4D145ED76138A5E2F8575EABF9
      A25FB52E7329963FFCC4931B6B48566D78EB20AF96966365DD3E4D5E2041DA97
      933A26804C5335544A59E37973C6F75EF3A2F8545C957F4ADBED6B04D0BDEF7B
      C7360E30B26388B51696B572B6A91006498E9B29A28E1041D10E8A8A8CD1A663
      3C73DD0FA399B46A5D6DF4F7AF1080FDD8B1A736D613BE6BF70D0C70E59CD408
      264054D413B2F0260003293818A50942D75E1876D35659E7ED3E77FF0F9E79CF
      D67CDD1F265F79E0E3CCAC9661DADA20754304C1D101F58D2069FCEAF3CF6FEE
      A7D99DB6BF0366605B3FDE6525630000000049454E44AE426082}
  end
  object Imagem_P_esquerda: TImage
    Left = 8
    Top = 266
    Width = 32
    Height = 32
    AutoSize = True
    Picture.Data = {
      0954506E67496D61676589504E470D0A1A0A0000000D49484452000000200000
      00200806000000737A7AF40000000467414D410000B18F0BFC61050000000970
      48597300000EC200000EC20115284A800000000774494D4507E2040A11210272
      10EB050000001974455874536F667477617265005061696E742E4E4554207633
      2E352E343E8DCC76000005864944415478DAED964B6C155518C7CF6B1EB7B72D
      6DA9505A1E6D152D58ABA080C68D5BE3C28DBA92442271658C0B13E3A3445DBA
      736BE20B2526EA868751D8682112638CA09160882062A905EEBD3377EECC9D39
      CFCFEF16AB2D58A1C6604C38C9E4CECC9D39E737FFEF7FFEE750F21F377A1DE0
      7F0BF0F6E34FCCBCFBD81BAFC335077877DB76E6C05182433B00D8B6F32D774D
      00BE1E1FA771B5C69338F66551F8C618C8B59667EBB17AF9F0E17F0471D50047
      77ECA0D6392F8DA2B6A452599A67598F52DAA64A9EFB298EAB9F9D39ADBEAAC5
      8B86B822C089F11DF80C506BAC6F8D6E4F93647954A9DC94361A83859479AAF5
      F7D3529E487CDED8383C68D7DCD00B8CCEE916CB64AD23C658C08338ACD9FD6F
      BC09570FF0E23827002168DD03B218C893C6DA5AA5321AC5D19AAC28AA4D7087
      F25278A463596F7575EF525D0E029837FE450050CA38044011C1E05DFBC03B3B
      E16F018E8FBF44B9B39C185D42F41B88524390E7A3AAD1188BABD55BAAD54A57
      A328CE58DF3B18F4F41CEDE9E9AA740681F2187373BBB5485068ED9242EAA652
      99B12E41C27CEB8103764180A3CFED603E058F0374102DFB206BDE08593A0A69
      7A9B4E9291348E07EAF53A97D69E15EDE56FDBBBBB4F964BA51807370C27C61C
      F5894180444A5B69E6595DCAB3CADA93C0D8F493478FC8CB003E78782BED0E7D
      56F6841F7AA233107C35B3663D0E3EE6E2789D8BA22113D797AB346D974A1110
      5EE277769C0FDACBB11042524A2D9D930A780A1A1C8950FF73CD665453F23BE9
      DCE784F1636278287D7AFF7EF803E0FD871EA548CF3A390DDB28591A1018F4C1
      8D0AA36E2759B61EE278B58DE21E5B4F425714BCF5992C082D2FB7691E048632
      D6EA6C5E28B52E34E644D568FBAB9295AA315F48808F88105F06EBD6C5CF7CFA
      C965005E196C6709DC5A61F566AFC8EFE2593AC21A8D01923496600942C80B06
      E866824EA34210EA79F8CB514A3ACF54B3240A8F2A7AFFAC73D52A818392925D
      C4F30E95376CAC3DFBF1BEF90014C0F364DE2D8C1CE552DEC79BD93D3CA9AFF5
      9246AFC89A21DE43912D9DED7DC6EE33C7C27E56F87F85519862B45663F4A064
      F43DEA07131D9B36D79EDBB7670EC0235B294E3526ABE73B6CDEBC99CAE25E81
      007E9A8D8679BEA2A4743934960B00D67A1E83989896CB5BE74834FBC57F2A70
      F14CE36FC4194C7316C59C4D28C610C09FE8DA7277ED85BDBB611EF69B0F3C48
      2B3FFD18681C9069BDDE977243A8D4589B366BDBADEB6F73D089DEF0B1ACB440
      CD337C27BF28332C14810615C8D01F91E051C6F884E16C174380DE2D9B6BAFEC
      D90397E9F6C2CA95DC695DE6D62EF3AC1D0CAC5B57B26EACCDBA5BCBE0D6941C
      2CB10482043D5843016A946804D17666FA5DBA3052BC89C2A2024A8848337618
      38FF90FBFEE1FE2D9BA25777FF05C0F3FDFD14238BE1578658EC2E61615568CC
      0842DC5E76EED6D0B9419CDBBD08E05F20909E27643A22A4A2094151C0924B29
      5A1E619828423408E7C728E713C2F78FADDA7C67FADAEEBDB060123EB5A2AF55
      EBC0B3AE23D4A62FB476B8E4705A3AB803D3EDE61C432A0138778EC037D384FC
      80D71102283A2788660118E7C085508C8B0B8CB333A8C0857D53536A61EBFEDE
      9EEC5FC1B873825B57C2522C0D9C1DE60EC630CF6F4315FA7202E76B005FFC0C
      70A4E6DC053468C1E601C00C000E4E84E7390C2BAC022FB8EFE9FD9393EE8A00
      ADB67DE540EB198E460C4AC67423C04A076404B55E83599AD79DFBF6B435C74F
      1953C54F52EE92286EAD8CBEEF9152A9047EE0230C87EF4E9DBEFAD5B0D5B6AD
      5A45DBAC65A1750297B77643683F020CB46236B176F21725A74E4B991668FA94
      0928647ED5DBB445ED88B68F8C50D12C0435A68C26EDD4CED18635E964516467
      8AA6C2B2C0342EBD8BE973D17BC227068728D3384BD01BC639820016011C02C0
      246E3A16DBDFFF775B7E1DE03AC0BFD57E0317445C4EE803EE55000000004945
      4E44AE426082}
  end
  object Imagem_P_baixo: TImage
    Left = 560
    Top = 266
    Width = 32
    Height = 32
    AutoSize = True
    Picture.Data = {
      0954506E67496D61676589504E470D0A1A0A0000000D49484452000000200000
      00200806000000737A7AF40000000467414D410000B18F0BFC61050000000970
      48597300000EC200000EC20115284A800000000774494D4507E2040A11210272
      10EB050000001974455874536F667477617265005061696E742E4E4554207633
      2E352E343E8DCC76000005F94944415478DAC5975B885D6715C7D7FABE7DCE99
      6B32B9B43AA9B951DB148D14A7496C26D8FA22C5172FA082685BDAB4853608F5
      5164A24FE2A38A824AA542A962F0A54A91A23E24A3D314530983B93421C92433
      3967F6D967EFB3EF7B7F77D7515B2B82732D5DB0D9700EFB5BBFBDBEB5FEDF7F
      23BCCF816B7DE0FB8F3C821A1918CEC1D2DD2282400735AD24C0C10F5EF99DDB
      7480571F7F0CA3CE324BBA815717455348E9092599361694735010448AE84A44
      25894731A65F5B5AB29B02F0FBE34FA2D586F7DBEDA1C4EFEEA88A7C52D4629B
      90A2A5B4668ADE372780045112484F212C2AC67BDDB161397F7D61C56AAC08F0
      DAD3C7190134934E677BE607F7D579764454F53DA2AEB728A5B8A40AA4802E42
      C833C48B12F18CE2ECA23F329C5DB8B5B862155604F8D3B3CF0C00862BBFBBAB
      EEF61E5459F619591453222FB64921786D2D86086E19B11F01BC4EBDF01BC1D8
      5CA7D58AAEFAFEC6014E7FFD59EA363BE28270B7ED450FD92CFF9C4ED2C32A8E
      274451B2D218688373D710FA3EC06C8EF0724D55B8C579B894A666C3007F7EFE
      C40060D40BE33D5E143F8C69F679DB4F0EA95EB8556619665AC3023A7709A0BF
      846E360578B922EE1BC8C26E5D6D02C0374E7024806698EC6910004B7302880F
      EBA0B745A629A646C30DAAC00584F816B8336F035C23809EA83717A0F92F802F
      10C021F53F008E00E0DF0078FA3A6218BC9700830A0802C88C82EB00EF1DC099
      E79FE3CCBAD156141340B226800CD0D6A2721B0278E9AB5FF6EE1C1B1B1DCF8A
      BDC371F630A72970D1BBB740D116BC03309B00FCB224805B0460AC319E356ED9
      58B72E8023DB27D8B103F7363EB26B727C37E0BEED45FDC9565E7CD6F59329AA
      C0F87F03407C13608E007E4D8234DB03089CA53F9DD5B4945BD2C6AD09E0DBD3
      D3AC2ECBE610E7635B4786767CD06BEC9FB4EEE816213FCD92ECA00EC37195A6
      9051132E50828B741C2C029C2339FEAD66EC75BA7C43EA68014B5A4ECEE5995D
      35C08B8F3DC154E0376D55EE7052EE0529F60C29B56FA783833B2C4C35CB6A9F
      8D93615D145058034B740A5E45284988AE6AC439CEF979E3356E4A8FDF368C75
      68C9E4542FD0AB02F8C5F16710E99061FD700CEBFA6E27EA43B62CEFC73CDF3F
      2EE4EE6DDA4E0E0BB915CAD2334240ED2C740960094091244706D982F5F85BB2
      D1BC201ADEBC669C340A967FEE77C4EA018C66CD3419E752DC83524E63551DE5
      797E90F67FD768518E51053C14121DA9206D32247405003646AC4AC602C1F9E5
      BAD1385B359B6F68CE2FD2E6FB3FEDDC5E1DC03F3BFF89A7D8A8A8861A464F7A
      5A1F6C4A35DDA8AA633C8E0F7092608C13CFD56443E81C30741A562444098221
      802CE17C29E7FCCDCAF34E13C09BD2F3161DFDFE93DB8B66D50083F8E37327BC
      06C2584BEBBB5A524DF1B2FC940BC307CCB2BFC7F4C2719BE79E951206134627
      A0CD00AA84613BE67C3EF3F85CC5F99C6834AE1643C3A965A87FB670636D5370
      6E66863C8E6BB484D8E249F96128CA4FD8283AAABBDDFB69043FA4A36844E705
      4A1AAF82BA3C6110A58C5DC8393B937BFC2C015CD65E2348B64DC8172E5F5E9F
      0E9C3F7912C9F6B49831774055DD6B93E441D3EF1F3341F051E97777D6FD78A8
      10C26496B411F15ACAD91B2567A74BCF9B2F1A9E4FBEB1FE71BBFD7FE5784525
      BC323343CED30DBBBAFE802BAB8FD93C7B4807C111D1E9DC9D533FC4792E63A5
      16C8139ECB38FB0BBDF9DF2A8FDF4C5BCD8226C2BCB8B8B83129BE327392FC8E
      63A0D40835DD5E9B170FA8A03B5DF9FE5412867786FDB888AAF2EF9973B3B9E7
      FD95925FD70CE3C2F3D40B4BB737EE09DF01F9D68CE7AC9BD069BA5FF47A87EB
      B87F3489E3C96ED88B7A49329F6B7596925FA2F24764D5C58FDA9DCD71C56FC7
      A599EF0CC6AE5987D1844C9203A22A3F9EA5E94E9F00BA5178A5A8ABB7146287
      20AA1F769657957C4D008338FFCD93ACF4FD962ACB3BB49477E5653E128461E6
      F7BA415E16A173AEF85EB7BBA2075837C020FEF0E8714EC9878CD6C3825C719A
      C622E8F9759226CA596BBFDB6E6FFE97D1BBE3D4971E2579A0A604E07427BF6A
      4C2D2BFBE4ABAFAC29F1BA0106F1AB2F7EED3FCF3184AF9C7A695DC9D70DB099
      F1BE03FC0341D13E5DDAC106900000000049454E44AE426082}
  end
  object Imagem_P_direita: TImage
    Left = 560
    Top = 8
    Width = 32
    Height = 32
    AutoSize = True
    Picture.Data = {
      0954506E67496D61676589504E470D0A1A0A0000000D49484452000000200000
      00200806000000737A7AF40000000467414D410000B18F0BFC61050000000970
      48597300000EC200000EC20115284A800000000774494D4507E2040A11210272
      10EB050000001974455874536F667477617265005061696E742E4E4554207633
      2E352E343E8DCC760000058C4944415478DAED964B6C156514C7BFF33D67EECC
      9D3B73EF052A54443044834130C618085437A01161A32606C457E2D69D4B3554
      25262E8C71453098E04ADDB8206EDD180514B456A8A2D0425B5EA5C5B6B7771E
      DFC3730B02D7A280488809273399CCE47BFCE69CFF39DF0172930D6E01DC02F8
      5F02747206F3BD12747A1E2D33CE38A50428D55670BBADFF88BBA1001D8C0207
      6801480408102014943AFC34EE386FE892A7B7F7F55D35C4350178CA87D06AF0
      08E10B940A6F976A6EC458A7004A1821439CB86102309932AAA718B33B8E1DBB
      22481BC0D2850BC0680379969366B309795E10EB5CDB208A9724442EE4BCB680
      F17B2A94DEA708F111608002E93314069B9C8F4D099EE170B37D70C85D15C0DA
      CE4E6AF242586B3CADB5D045418DD68438D7C66911400378554A67DD01B0BC0A
      B0D227301BC3728252F811017A32CA0E678C9E318C360D6AE383E1E3F68A00EB
      E6CE9526CF675963E75BA367E1E6D21A03E7002E1ABE51F489F401920E42EE9E
      43E0FE08600EBE4F30805F3485EF9B94F6A68C1D4E053F51303A81D3B2F78F9F
      B07F0BF0CA8627E0D89EEF429DE74B9C315DC49825A07599D89900AD3908C004
      4A2221A43E1B75398B40181192A31746524AFB1B94FED464F48794F33ECD0085
      006751A429E5DCBE3D3CEC6600BCBA613D0CEFDE9BA0075680314F611C5648AD
      13612CCACBC1F47FFF851B634E034244D5E14D084300CB08644D0ABF37800E4C
      B169881E0CC5C182B17EC3D8292A44E3ADC1413303E0B5F5EB6164F79EAACDF3
      2E6EECC6C09AAE449B24B016B8BBBC86508C04C5083E3E83568638D24A459711
      C8A7288C4F323A8C423C944AD9932BB5DF0A7140F8FEF1FA9D77652FEEFADCB5
      01BCF5C40638BBFB9BAA430069EDA6D8D8AE0E6393043D20CEFF3D9C7FBA4B26
      D2739E209C4C0B63DA50A036E5CC34A568A4B8611E06BDBA147CED94F715F34B
      BFA8DAEC0910C23EF3C94E770160EBBAF530B1770F02645DCABA4D55EB56CFB5
      AE5AB70EA4FBBB2C72E7685A69FAE79856B018734629A783525A44E51113550E
      1904C06F5F6AAE7A0BE58FA1AB8A673EFBF822C03B8FAF83C6FE7D555214AB94
      231B6B0456CFA3B45623B495F36DE9E22E3C1D386D882B0AE2CEA72B705481EF
      5908C39444E5DF6DB93C6482B0AFF0FC6F35137B9A400F35808D633AB403BCFB
      E863901D3C1813AD1F52004FD6385F799B54F51A174C606061E6BF83437D982C
      E3A631256C86B5AF1506CF33AC12A52C8947218E8F922038A0B9FC2107DA8BDA
      E89F72E4CCB8712902D83680F7D6AE057DF8488869B74451FA7055AAA5734AA5
      249192B7CA2C5C522FA673C23986C54A65938D381F9F980DBA8894944486E124
      8F2B2769921CA1717C1082B0C7327E20D3E6685AE8F146A1F3B134B74F7FBAB3
      5D842DFB60D97205D67648C61655949A572FF941A414C3DC6E2BC5AD4A5858CB
      1BCD663C3936B6484F36EE538CCDAB542A268CE32111457D18821F71F35E084A
      BF11A14E182C52B98362D9D62D338AD185B577AE59C3504C3E67342A4919449E
      129E1094B505C011DC9C8E67991C1D3D5BCF464797B1BC585DF6BCF9B55AFD6C
      5CABFD2CCBE51EF0FD5E22E511E0FC34E102CB3133F774BF7159355F587DD773
      9B5B9E6658CF39E78CA1F729C3A3F7D2FD5B626F64191C1D3923264E8DD4FC66
      BABC047455E079B5244E06AAF57AAF1F950F81F28630D546F1644C17BFD96DC8
      3F589BBEBE78E945EC2B000918C11B584B5A978C689D8C03A74760DFE17E16E5
      A6DCA1D4E250887B3DA5FCB05CEE4FEAF55FC3283AC9B898C43E256F697571F7
      96AB3B0DAFC51EACC6F491F90BE49D715C0BA59A23A5607E108C46F5FA993049
      B00AD362D9962D57D594FCEB9EF0F5152BE8BC4A2C7D2114C60CBDEEE5511CE7
      71AD6A1EE8EEBE311DD15F6DC7E617E8B44A70150AD43DBB63BBBDD635AEBB2B
      FEE8A597A7D778FEC36DD7D48CFE6700D76BB7006E3AC01F83444D3F9E2B3792
      0000000049454E44AE426082}
  end
end

terça-feira, 24 de setembro de 2019

C++ Builder - desenhando partes de uma imagem

Quando clicamos no botão Draw, uma variável
global inteira inicializada em -1 é incrementada
e estes valores serão utilizados para a chamada
de cada parte recortada de nosso bitmap,
e estas chamadas só ocorrem clicando neste mesmo botão,
onde preferimos usar um nome em inglês para encurtar
o seu tamanho.
O botão imagem, chama o bitmap principal,
mas o programa funciona muito bem sem ele,
na verdade está servindo como personalização,
e para que o usuário saiba de onde está sendo
desenhado o bitmap em tempo de execução.
Então sem entrar em detalhes da parte gráfica de bitmaps,
o que estamos fazendo aqui é recortando partes
do bitmap, estrategicamente e desenhando num destino
escolhido preferivelmente por nós mesmos.



//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <memory>
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int a = -1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1 ( TComponent* Owner )
: TForm ( Owner )
{
}
Graphics::TBitmap* bitimap;
//---------------------------------------------------------------------------
void __fastcall TForm1::Informe ( TObject *Sender ) {
    Canvas -> Font -> Name = "Garamond";
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Color = clBlack;
    Canvas -> TextOut ( 200, 240, "Por: " );
    Canvas -> Font -> Color = clRed;
    Canvas -> TextOut ( 240, 240, "Samuel Lima" );
    Canvas -> Font -> Color = clBlue;
    Canvas -> TextOut ( 196, 260, "sa_sp10@hotmail.com" );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click ( TObject *Sender )
{
    //Coordenadas do primeiro bitmap
    Canvas -> Draw ( 30, 40, bitimap );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click ( TObject *Sender )
{
    String str;
    int x;
    int y;
    int largura;
    int altura;
    int x_1;
    int y_1;
    int largura_1;
    int altura_1;
    a++;
    if ( a < 10 ) {
      str = "0";
    }
    str += a;
    Label1 -> Caption = str;
    /*====================================================================*/
    if ( a == 0 ) {
        //Posição do recorte a ser capturado
        x = 68;
        y = 134;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
    if ( a == 1 ) {
        //Posição do recorte a ser capturado
        x = 0;
        y = 0;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
    if ( a == 2 ) {
        //Posição do recorte a ser capturado
        x = 68;
        y = 0;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
    if ( a == 3 ) {
        //Posição do recorte a ser capturado
        x = 133;
        y = 0;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
        }
        /*====================================================================*/
        if ( a == 4 ) {
        //Posição do recorte a ser capturado
        x = 199;
        y = 0;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
        }
        /*====================================================================*/
        if ( a == 5 ) {
        //Posição do recorte a ser capturado
        x = 0;
        y = 67;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
        /*====================================================================*/
        if ( a == 6 ) {
        //Posição do recorte a ser capturado
        x = 68;
        y = 67;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
    if ( a == 7 ) {
        //Posição do recorte a ser capturado
        x = 133;
        y = 67;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
        if ( a == 8 ) {
        //Posição do recorte a ser capturado
        x = 199;
        y = 67;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
        if ( a == 9 ) {
        //Posição do recorte a ser capturado
        x = 0;
        y = 134;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
    if ( a == 10 ) {
        //Posição do recorte a ser capturado
        x = 133;
        y = 134;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
        if ( a == 11 ) {
        //Posição do recorte a ser capturado
        x = 199;
        y = 134;
        //Tamanho do recorte a ser capturado
        largura = 60;
        altura = 60;
        // imprimindo a região cortada
        //Posicionamento do recorte capturado da imagem
        x_1 = 403;
        y_1 = 50;
        //Tamanho do recorte destino
        largura_1 = 60;
        altura_1 = 60;
    }
    /*====================================================================*/
    Canvas -> CopyRect (
            //o primeiro ret é o destino
            TRect ( x_1, y_1, x_1 + largura_1, y_1 + altura_1 )
            //segundo é a tela da fonte
            ,bitimap -> Canvas
            //terceiro é o retângulo da fonte que desejamos copiar
            ,TRect ( x, y, x + largura, y + altura )
    );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPaint(TObject *Sender)
{
    bitimap = new Graphics::TBitmap ( );
    bitimap -> Width = 200;
    bitimap -> Height = 200;
    bitimap -> LoadFromFile ("C:\\Users\\ManMachine\\Downloads\\"
            "\\Contador personalizado manual\\números.bmp" );
                Canvas -> Pen -> Width = 10;
    Canvas -> Pen -> Color = clRed;
    Canvas -> Rectangle ( 05, 05, 595, 295 );
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Name = "arial";
    Canvas -> Font -> Color = clRed;
    Canvas -> Font-> Style = TFontStyles ( ) << fsBold << fsItalic << fsUnderline;
    Canvas -> TextOut ( 110, 12, "DESENHANDO PARTES DE UMA IMAGEM" );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnTimer(TObject *Sender)
{
   if ( a == 12 ) {
      Informe ( Sender );
    }
    if ( a == 13 ) {
       Form1 -> Close ( );
    }
}
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#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
    TButton *Button1;
    TButton *Button2;
    TLabel *Label1;
    TTimer *Timer1;
    void __fastcall Informe ( TObject *Sender );
    void __fastcall Button2Click(TObject *Sender);
    void __fastcall Button1Click(TObject *Sender);
    void __fastcall OnPaint(TObject *Sender);
    void __fastcall OnTimer(TObject *Sender);
private:    // User declarations
public:        // User declarations
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif



object Form1: TForm1
  Left = 455
  Top = 89
  Caption = 'DESENHANDO PARTES DE UMA IMAGEM'
  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 Label1: TLabel
    Left = 376
    Top = 144
    Width = 46
    Height = 81
    Caption = ' '
    Font.Charset = ANSI_CHARSET
    Font.Color = clRed
    Font.Height = -77
    Font.Name = 'alarm clock'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Button1: TButton
    Left = 104
    Top = 259
    Width = 75
    Height = 25
    Caption = 'Imagem'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 0
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 440
    Top = 259
    Width = 75
    Height = 25
    Caption = 'Draw'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 1
    OnClick = Button2Click
  end
  object Timer1: TTimer
    Interval = 2000
    OnTimer = OnTimer
    Left = 536
    Top = 24
  end
end


segunda-feira, 23 de setembro de 2019

C++ Builder - Calculando hipotenusa

O Teorema de Pitágoras é considerado uma das
principais descobertas da Matemática.
Ele descreve uma relação existente no triângulo retângulo.
Vale lembrar que o triângulo retângulo pode ser identificado
pela existência de um ângulo reto, isto é, que mede 90º.
O triângulo retângulo é formado por dois catetos e a hipotenusa,
que constitui o maior segmento do triângulo
e localiza-se opostamente ao ângulo reto, e sua fórmula é esta abaixo:
Cateto a² + Cateto b² = h²
O Teorema de Pitágoras diz que:
“a soma dos quadrados dos catetos é igual ao quadrado da hipotenusa.”

Fonte: https://brasilescola.uol.com.br/matematica/teorema-pitagoras.html

Partindo destas informações ficou muito fácil
converter sua fórmula matemática em uma equação
em que o computador possa entender, e foi o que fizemos.
Na verdade isto é muito simples, e nos foi ensinado
quando estávamos dando nossos primeiros passos no mundo
maravilhoso da programação, a única diferença é que aqui,
estamos utilizando uma janela gráfica feita no
C++ Builder da Embarcadero, e eu estou usando a versão 10.3.
É uma pena que muitos não conhecem o poder desta ferramenta
profissional que pertencia no início a Borland,
mas de alguns anos para hoje pertence a Embarcadero,
e na minha opinião é a melhor opção para quem estuda
linguagem C ou C++, e não quer mudar de linguagem,
por estar familiarizado com suas sintaxes.


Veja abaixo um vídeo com o programa em execução:




//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include <math.h>
#include "Unit1.h"
#include <memory>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
 //---------------------------------------------------------------------------
void __fastcall TForm1::Informe ( TObject *Sender ) {
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Color = clBlack;
    Canvas -> TextOut ( 200, 240, "Por: " );
    Canvas -> Font -> Color = clRed;
    Canvas -> TextOut ( 240, 240, "Samuel Lima" );
    Canvas -> Font -> Color = clBlack;
    Canvas -> Font -> Name = "Garamond";
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Color = clSkyBlue;
    Canvas -> TextOut ( 196, 266, "sa_sp10@hotmail.com" );
    SetBkMode ( Canvas -> Handle, TRANSPARENT );
    Canvas -> Font -> Color = clBlue;
    Canvas -> TextOut ( 190, 260, "sa_sp10@hotmail.com" );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
     Canvas -> Pen -> Width = 10;
    Canvas -> Pen -> Color = clRed;
    Canvas -> Rectangle ( 05, 05, 595, 295 );
    Canvas -> Font -> Size = 14;
    Canvas -> Font -> Name = "arial";
    Canvas -> Font -> Color = clRed;
    Canvas -> Font-> Style = TFontStyles ( ) << fsBold << fsItalic << fsUnderline;
    Canvas -> TextOut ( 180, 12, "CALCULANDO HIPOTENUSA" );
    Informe ( Sender );
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  double c1 = 0.00, c2 = 0.00, h = 0.00;
  c1 = StrToFloat ( Edit1 -> Text );
  c2 = StrToFloat ( Edit2 -> Text );
  h = sqrt ( pow ( c1, 2 ) + pow ( c2, 2 ) );
  Edit3 -> Text = FloatToStrF ( h, ffFixed, 2, 2 );
  Image1->Picture->LoadFromFile("C:\\Users\\ManMachine\\Downloads\\"
    "\\Calculando hipotenusa\\trianguloReto.bmp");

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
 Form1 -> Close ( );
}
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Imaging.pngimage.hpp>
#include <Vcl.Graphics.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TEdit *Edit1;
    TEdit *Edit2;
    TBevel *Bevel1;
    TEdit *Edit3;
    TLabel *Label1;
    TLabel *Label2;
    TLabel *Label3;
    TButton *Button1;
    TButton *Button2;
    TBevel *Bevel2;
    TImage *Image1;
    void __fastcall Informe ( TObject *Sender );
    void __fastcall FormPaint(TObject *Sender);
    void __fastcall Button1Click(TObject *Sender);
    void __fastcall Button2Click(TObject *Sender);
private:    // User declarations
public:        // User declarations
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif



object Form1: TForm1
  Left = 455
  Top = 177
  Caption = 'CALCULANDO HIPOTENUSA'
  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 = FormPaint
  PixelsPerInch = 96
  TextHeight = 13
  object Bevel1: TBevel
    Left = 32
    Top = 47
    Width = 265
    Height = 186
  end
  object Label1: TLabel
    Left = 55
    Top = 70
    Width = 56
    Height = 16
    Caption = 'Cateto 1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label2: TLabel
    Left = 55
    Top = 108
    Width = 56
    Height = 16
    Caption = 'Cateto 2'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label3: TLabel
    Left = 55
    Top = 151
    Width = 73
    Height = 16
    Caption = 'Hipotenusa'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Bevel2: TBevel
    Left = 312
    Top = 47
    Width = 265
    Height = 170
  end
  object Image1: TImage
    Left = 328
    Top = 64
    Width = 233
    Height = 137
  end
  object Edit1: TEdit
    Left = 152
    Top = 69
    Width = 121
    Height = 24
    Alignment = taRightJustify
    Color = clOlive
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 0
    Text = ' '
  end
  object Edit2: TEdit
    Left = 152
    Top = 107
    Width = 121
    Height = 24
    Alignment = taRightJustify
    Color = clOlive
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 1
    Text = ' '
  end
  object Edit3: TEdit
    Left = 152
    Top = 150
    Width = 121
    Height = 24
    Alignment = taRightJustify
    Color = clOlive
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 2
    Text = ' '
  end
  object Button1: TButton
    Left = 53
    Top = 192
    Width = 75
    Height = 25
    Caption = 'Calcular'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 3
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 198
    Top = 192
    Width = 75
    Height = 25
    Caption = 'Sair'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 4
    OnClick = Button2Click
  end
end

segunda-feira, 3 de junho de 2019

C++ builder - Pesquisando em matriz de inteiros

Este programa foi criado no C++ builder,
e oferece aos usuários uma precisa e rápida
pesquisa em valores armazenados numa matriz 
de inteiros, é indicado aos iniciantes em C/C++,
Que estão utilizando esta poderosa IDE
da Embarcadero, que é sem dúvidas a melhor
opção para criação de janelas em C++.





//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

AnsiString str_1;
AnsiString str_2;
int n;
int a = 0, b = 0;
int A [ 10 ] [ 10 ], i;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
   //Limpa o Edit na entrada
{  Edit1 -> Clear ( );
}
 //---------------------------------------------------------------------------
void __fastcall TForm1::Informe ( TObject *Sender ) {
Canvas -> Font -> Size = 14;
Canvas -> Font -> Color = clBlack;
Canvas -> TextOut ( 200, 240, "Por: " );
Canvas -> Font -> Color = clRed;
Canvas -> TextOut ( 240, 240, "Samuel Lima" );
Canvas -> Font -> Color = clBlack;
    Canvas -> Font -> Name = "Garamond";
Canvas -> Font -> Size = 14;
Canvas -> Font -> Color = clSkyBlue;
Canvas -> TextOut ( 196, 266, "sa_sp10@hotmail.com" );
SetBkMode ( Canvas -> Handle, TRANSPARENT );
Canvas -> Font -> Color = clBlue;
Canvas -> TextOut ( 190, 260, "sa_sp10@hotmail.com" );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnCreate(TObject *Sender)
{
for( i = 0; i < 100; i++ ) {
A [ b ] [ a ] =  i;
a++;
}
for ( a = 0; a < 10; a++ ) {
for ( b = 0; b < 10; b++ ) {

AppendStr ( str_1, "\t" );

if ( A [ a ] [ b ] % 10 == 0 ) {
AppendStr ( str_1, "\n" );
}

if ( A [ a ] [ b ] >= 0 && A [ a ] [ b ] < 10 ) {
AppendStr ( str_1, "0" );
}
   AppendStr ( str_1, A [ a ] [ b ] );
}
}
Label1 -> Caption = str_1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPaint(TObject *Sender)
{
Canvas -> Pen -> Color = clBlue;
Canvas -> Brush -> Color = static_cast < TColor > ( RGB ( 0,255,255 ) );
Canvas -> Pen -> Width = 10;
Canvas -> Rectangle ( 05, 05, 595, 295 );
Canvas -> Font -> Size = 14;
Canvas -> Font -> Name = "arial";
Canvas -> Font -> Color = clRed;
Canvas -> TextOut ( 148, 15, "PESQUISA EM MATRIZ DE INTEIROS" );

Canvas -> Font -> Size = 8;
Canvas -> Font -> Name = "arial";
Canvas -> Font -> Color = clBlack;
Canvas -> TextOut ( 40, 245, "Pesquisa" );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
n = StrToInt ( Edit1 -> Text );
if ( n > 99 ) {
  Beep ( 1000, 500 );
}
Label1 -> Caption = " ";
str_1 = " ";
str_2 = " ";
for ( a = 0; a < 10; a++ ) {
for ( b = 0; b < 10; b++ ) {

AppendStr ( str_1, "\t" );
AppendStr ( str_2, "\t" );

if ( A [ a ] [ b ] % 10 == 0 ) {
AppendStr ( str_1, "\n" );
AppendStr ( str_2, "\n" );
}

if ( A [ a ] [ b ] >= 0 && A [ a ] [ b ] < 10 ) {
AppendStr ( str_1, "0" );
   if ( n > 0 && n < 10 && A [ a ] [ b ] == n )
   AppendStr ( str_2, "0" );
}

   AppendStr ( str_1, A [ a ] [ b ] );
   if ( n > 0 )
if ( A [ a ] [ b ] == n ) {
AppendStr ( str_2, n );
}
}
}
Label1 -> Caption = str_1;
Label2 -> Caption = str_2;
//Limpa o Edit para uma nova pesquisa
Edit1 -> Clear ( );
//Posiciona o cusrsor do Edit para uma nova pesquisa
Edit1 -> SetFocus ( );
Informe ( Sender );
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TLabel *Label2;
TEdit *Edit1;
    TButton *Button1;
void __fastcall OnPaint(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall OnCreate(TObject *Sender);
    void __fastcall Informe ( TObject *Sender );
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif


object Form1: TForm1
  Left = 398
  Top = 133
  Caption = 'PESQUISA EM MATRIZ DE INTEIROS'
  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
  OnCreate = OnCreate
  OnPaint = OnPaint
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 36
    Top = 28
    Width = 5
    Height = 19
    Caption = ' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlack
    Font.Height = -16
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 36
    Top = 28
    Width = 5
    Height = 19
    Caption = ' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -16
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Edit1: TEdit
    Left = 36
    Top = 261
    Width = 53
    Height = 26
    AutoSelect = False
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -15
    Font.Name = 'Tahoma'
    Font.Style = []
    NumbersOnly = True
    ParentFont = False
    TabOrder = 0
    Text = ' '
  end
  object Button1: TButton
    Left = 95
    Top = 261
    Width = 34
    Height = 25
    Caption = 'Ok'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -15
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 1
    OnClick = Button1Click
  end
end

quinta-feira, 16 de maio de 2019

C++ builder - de inteiro para hex e bin

Este programa feito no C++ builder,
converte números inteiros em Hexadecimal
e binário, mas pode ser expandido 
para cálculos diversos graças ao teclado 
numérico que criamos utilizando botões
e programando rotinas de códigos para
acionamento dos eventos chamados pelo
click do mouse, ou na entrada pelo teclado.
Não vou detalhar como fiz mas deixo postado
os códigos para quem tiver interesse
em testar este ótimo programa.


#include <vcl.h>
#include <stdio.h>
#include <ctype.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
AnsiString Dest;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1( TComponent* Owner )
: TForm ( Owner )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
}
class Convert_Dec_Bin {
public:
const static int DEC = 1;
int DecBin( int dec ){
int bin = 0, tp = 1;
while ( dec > 0 ){
bin = bin + ( dec % 2 ) * tp;
dec = dec / 2;
tp *= 10;
}
return bin;
}
};
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "1";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button13Click ( TObject *Sender )
{
int StrInt;
StrInt = StrToInt ( Edit1 -> Text );
Convert_Dec_Bin conv;
int x = Edit1 -> Text.ToIntDef ( 0 );
int conversor = conv.DecBin ( x );
if ( x > 0 ) {
Edit1 -> Text = conversor;
} else {
Edit1 -> Clear ( );
}
Edit1 -> SetFocus ( );
Dest = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button14Click ( TObject *Sender )
{
String inf = "   Criado por: Samuel Lima\n\n";
String inf_1 = "        MUITO OBRIGADO";
Memo1 -> Enabled = true;
Memo1 -> Visible = true;
Memo1 -> Lines -> Strings [ 0 ] = inf;
Memo1 -> Lines -> Strings [ 1 ] = inf_1;
Sleep ( 2800 );
exit ( 0 );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click ( TObject *Sender )
{
int StrInt;
StrInt = StrToInt ( Edit1 -> Text );
Edit1 -> Text = IntToHex ( StrInt, 1 );
Dest = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "2";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
 void __fastcall TForm1::Button4Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "3";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "4";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "5";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "6";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button8Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "7";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button9Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "8";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
 void __fastcall TForm1::Button10Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "9";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button11Click ( TObject *Sender )
{
 Memo1 -> Enabled = false;
 Memo1 -> Visible = false;
 int i = 0, um = 0;
  um++;
  char str [ ] = "0";
  while ( i < 10 ) {
AppendStr ( Dest, str );
Edit1 -> Text = Dest;
i++;
break;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button12Click ( TObject *Sender )
{
Edit1 -> Clear ( );
Edit1 -> Text = "0";
Dest = "";
Edit1 -> SetFocus ( );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnPaint ( TObject *Sender )
{
 Canvas -> Font -> Size = 13;
 Canvas -> Font -> Name = "Arial";
 Canvas -> Font -> Style = TFontStyles ( ) << fsBold;
 //Colorindo a janela
 Canvas -> Brush -> Color = static_cast < TColor > ( RGB ( 0, 255, 255 ) );
 Canvas -> Pen -> Width = 10;
 Canvas -> Pen -> Color = clBlack;
 Canvas -> Rectangle ( 05, 05, 315, 213 );
 Canvas -> Font -> Color = clRed;
 Canvas -> TextOut ( 42, 10, "DE INTEIRO PARA HEX E BIN" );
Form1 -> Constraints -> MaxHeight = 255;
Form1 -> Constraints -> MaxWidth = 335;
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.Buttons.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TLabel *Label2;
TEdit *Edit1;
TShape *Shape1;
TButton *Button1;
TButton *Button2;
TButton *Button3;
TButton *Button4;
TButton *Button5;
TButton *Button6;
TButton *Button7;
TButton *Button8;
TButton *Button9;
TButton *Button10;
TButton *Button11;
TButton *Button12;
TButton *Button13;
TButton *Button14;
TMemo *Memo1;

void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
void __fastcall Button4Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall Button6Click(TObject *Sender);
void __fastcall Button7Click(TObject *Sender);
void __fastcall Button8Click(TObject *Sender);
void __fastcall Button9Click(TObject *Sender);
void __fastcall Button10Click(TObject *Sender);
void __fastcall Button11Click(TObject *Sender);
void __fastcall Button12Click(TObject *Sender);
void __fastcall Button13Click(TObject *Sender);
void __fastcall Button14Click(TObject *Sender);

void __fastcall OnPaint(TObject *Sender);

private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif


object Form1: TForm1
  Left = 541
  Top = 118
  Caption = 'DE INTEIRO PARA HEXADECIMAL'
  ClientHeight = 217
  ClientWidth = 317
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poDesigned
  Visible = True
  OnPaint = OnPaint
  DesignSize = (
    317
    217)
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 304
    Top = 96
    Width = 5
    Height = 21
    Caption = ' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -17
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 320
    Top = 96
    Width = 5
    Height = 21
    Caption = ' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clRed
    Font.Height = -17
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
  end
  object Shape1: TShape
    Left = 23
    Top = 33
    Width = 275
    Height = 77
    Brush.Style = bsClear
    Pen.Color = clBlue
    Pen.Width = 5
  end
  object Button1: TButton
    Left = 22
    Top = 115
    Width = 41
    Height = 25
    Caption = '1'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 0
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 210
    Top = 146
    Width = 41
    Height = 25
    Caption = 'H'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 2
    OnClick = Button2Click
  end
  object Edit1: TEdit
    AlignWithMargins = True
    Left = 28
    Top = 38
    Width = 265
    Height = 68
    Alignment = taRightJustify
    Anchors = []
    AutoSelect = False
    AutoSize = False
    BevelWidth = 10
    Color = clOlive
    Font.Charset = ANSI_CHARSET
    Font.Color = clWindowText
    Font.Height = -21
    Font.Name = 'Arial'
    Font.Style = [fsItalic]
    NumbersOnly = True
    ParentFont = False
    TabOrder = 1
    Text = '0'
  end
  object Button3: TButton
    Left = 69
    Top = 115
    Width = 41
    Height = 25
    Caption = '2'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 3
    OnClick = Button3Click
  end
  object Button4: TButton
    Left = 116
    Top = 115
    Width = 41
    Height = 25
    Caption = '3'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 4
    OnClick = Button4Click
  end
  object Button5: TButton
    Left = 163
    Top = 115
    Width = 41
    Height = 25
    Caption = '4'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 5
    OnClick = Button5Click
  end
  object Button6: TButton
    Left = 210
    Top = 115
    Width = 41
    Height = 25
    Caption = '5'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 6
    OnClick = Button6Click
  end
  object Button7: TButton
    Left = 257
    Top = 115
    Width = 41
    Height = 25
    Caption = '6'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 7
    OnClick = Button7Click
  end
  object Button8: TButton
    Left = 22
    Top = 146
    Width = 41
    Height = 25
    Caption = '7'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 8
    OnClick = Button8Click
  end
  object Button9: TButton
    Left = 69
    Top = 146
    Width = 41
    Height = 25
    Caption = '8'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 9
    OnClick = Button9Click
  end
  object Button10: TButton
    Left = 116
    Top = 146
    Width = 41
    Height = 25
    Caption = '9'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 10
    OnClick = Button10Click
  end
  object Button11: TButton
    Left = 163
    Top = 146
    Width = 41
    Height = 25
    Caption = '0'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 11
    OnClick = Button11Click
  end
  object Button12: TButton
    Left = 257
    Top = 146
    Width = 41
    Height = 25
    Caption = 'CR'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 12
    OnClick = Button12Click
  end
  object Button13: TButton
    Left = 23
    Top = 177
    Width = 41
    Height = 25
    Caption = 'B'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 13
    OnClick = Button13Click
  end
  object Button14: TButton
    Left = 70
    Top = 177
    Width = 228
    Height = 25
    Caption = 'Sair do programa'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    ParentFont = False
    TabOrder = 14
    OnClick = Button14Click
  end
  object Memo1: TMemo
    Left = 28
    Top = 38
    Width = 265
    Height = 68
    Color = clOlive
    Enabled = False
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -19
    Font.Name = 'Tahoma'
    Font.Style = []
    Lines.Strings = (
      ' ')
    ParentFont = False
    TabOrder = 15
  end
end