sábado, 10 de julho de 2021

C++ / CLI - Pares e ímpares em matriz de inteiros

Se seu visual studio tem as ferramentas para programar
em C++/CLI, abra-o imediatamente e crie um novo projeto,
Selecionando: Projeto CLR Vazio (.NET Framework).
Se seu visual studio não tem estes recursos instalados,
mas você tem interesse em conhece-los, instale-os
agora mesmo, se não sabe como fazer, Podemos te ajudar.

Este programa faz leitura de uma matriz nativa do C,
e marca em highlighter todos os números pares e ímpares,
em duas cores diferentes e sua impressão é numa janela gráfica 
criada em .NET com C++/CLI, sei que muitos vão me criticar
mas não me importo, eu gosto do .NET mesmo.
"VIVA O .NET E VIVA O C++" 



            /*============================================================*/
            void Cria_Moldura ( PaintEventArgse ) {
                Graphics^ g = e->Graphics;
                Image^ imagem_1 = Image::FromFile ( "C:\\Users\\Olilim\\Downloads\\" +
                    "Dez_Mil_Inteiros_Em_DrawString\\Debug\\Moldura_1.bmp" );
                g->DrawImage ( imagem_1, 00 );
            }
            /*============================================================*/
            void FlowLayoutPanel_1 ( int Xint Yint Wint H ) {
                //this->flowLayoutPanel1->AutoSize = true;
                this->flowLayoutPanel1->AutoScrollMinSize = System::Drawing::Size ( 40020100 );
                this->flowLayoutPanel1->Font = ( gcnew System::Drawing::Font ( L"Times New Roman",
                    10.25FSystem::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
                    static_castSystem::Byte >( 0 ) ) );
                this->flowLayoutPanel1->ForeColor = System::Drawing::Color::Black;
                this->flowLayoutPanel1->BackColor = System::Drawing::Color::White;
                this->flowLayoutPanel1->Location = System::Drawing::Point ( X, Y );
                this->flowLayoutPanel1->Name = L"flowLayoutPanel1";
                this->flowLayoutPanel1->Size = System::Drawing::Size ( W, H );
                this->flowLayoutPanel1->TabIndex = 0;
            }
            /*============================================================*/
        private: System::Void MyForm_Paint ( System::Object^ sender, 
        System::Windows::Forms::PaintEventArgs^ e ) {
            Cria_Moldura ( e );

            SolidBrush^ textBrushA = gcnew SolidBrush ( Color::Red );
            SolidBrush^ textBrushB = gcnew SolidBrush ( Color::Black );

            Graphics^ g = e->Graphics;
            System::Drawing::Font^ textFont = ( gcnew System::Drawing::Font ( L"Times New Roman",
                12static_castSystem::Drawing::FontStyle >( ( System::Drawing::FontStyle::Bold |
                    System::Drawing::FontStyle::Italic ) ),
                System::Drawing::GraphicsUnit::Point, static_castSystem::Byte >( 0 ) ) );
            g->DrawString ( "C++ / CLI - PARES E ÍMPARES EM MATRIZ DE INTEIROS",
                textFont, textBrushA, 8010 );     
            g->DrawString ( "Por:", textFont, textBrushA, 240265 );
            g->DrawString ( "Samuel Lima", textFont, textBrushB, 280265 );
        }
               /*============================================================*/