domingo, 27 de junho de 2021

C# - pesquisando e marcando vogais


Este programinha marca todas
as ocorrências das vogais 
encontrada numa matriz 2D de string.
É indicado a iniciantes, e não faz
uso de nenhum método de pesquisa do C#.
Quer saber como fiz, clique no link
agora mesmo, mas antes assista o vídeo.




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Textbox_to_Array {
    public partial class Form1 : Form {
        string [ ] texto = {
         "Em cismar, sozinho, à noite, ",
         "Mais prazer encontro eu lá;  ",
         "Minha terra tem palmeiras,   ",
         "Onde canta o Sabiá.          ",
         "Minha terra tem primores,    ",
         "Que tais não encontro eu cá; ",
         "Em cismar — sozinho, à noite ",
         "Mais prazer encontro eu lá;  ",
         "Minha terra tem palmeiras,   ",
         "Onde canta o Sabiá.          "};
        /*============================================================*/
        void Informe ( PaintEventArgs e ) {
            Graphics dc = e.Graphics;
            Font myFont = new System.Drawing.Font ( "Helvetica"11FontStyle.Italic );
            Brush myBrush_1 = new SolidBrush ( System.Drawing.Color.Red );
            Brush myBrush_2 = new SolidBrush ( System.Drawing.Color.Blue );
            Brush myBrush_3 = new SolidBrush ( System.Drawing.Color.Black );
            dc.DrawString ( "Por: "myFontmyBrush_1350250 );
            dc.DrawString ( "Samuel Lima "myFontmyBrush_2380250 );
            dc.DrawString ( "sa_sp10@hotmail.com "myFontmyBrush_3350265 );
            //Imprime_Array ( e );
        }
        /*============================================================*/
        void Label_1 ( int Xint Yint Wint Hstring st ) {
            label1.Font = new System.Drawing.Font ( "Microsoft Sans Serif",
            9.75FSystem.Drawing.FontStyle.Italic,
            System.Drawing.GraphicsUnit.Point, ( ( byte ) ( 0 ) ) );
            label1.ForeColor = System.Drawing.Color.Black;
            label1.Location = new System.Drawing.Point ( XY );
            label1.Name = "label1";
            label1.Size = new System.Drawing.Size ( WH );
            label1.TabIndex = 2;
            label1.Text = st;
        }
        /*============================================================*/
        void TextBox_1 ( int Xint Yint Wint H ) {
            textBox1.Font = new System.Drawing.Font ( "Microsoft Sans Serif",
            8FSystem.Drawing.FontStyle.Italic,
            System.Drawing.GraphicsUnit.Point, ( ( byte ) ( 0 ) ) );
            textBox1.ForeColor = System.Drawing.Color.Black;
            textBox1.Location = new System.Drawing.Point ( XY );
            textBox1.Name = "textBox1";
            textBox1.Size = new System.Drawing.Size ( WH );
            textBox1.TabIndex = 3;
        }
        /*============================================================*/
        public void Button_1 ( int Xint Yint Wint Hstring st ) {
            textBox1.Focus ( );
            button1.Location = new Point ( XY );
            this.button1.Size = new System.Drawing.Size ( WH );
            button1.Font = new Font ( "Times New Roman"10F,
             System.Drawing.FontStyle.ItalicSystem.Drawing.GraphicsUnit.Point0 );
            button1.BackColor = Color.Pink;
            button1.ForeColor = Color.FromArgb ( 000 );
            this.button1.Text = st;
        }
        /*============================================================*/
        public void Button_2 ( int Xint Yint Wint Hstring st ) {
            button2.Location = new Point ( XY );
            this.button2.Size = new System.Drawing.Size ( WH );
            button2.Font = new Font ( "Times New Roman"13F,
             System.Drawing.FontStyle.ItalicSystem.Drawing.GraphicsUnit.Point0 );
            button2.BackColor = Color.LightGreen;
            button2.ForeColor = Color.FromArgb ( 000 );
            this.button2.Text = st;
        }
        /*============================================================*/
        private void Moldura ( PaintEventArgs e ) {
            System.Drawing.Graphics dc;
            dc = this.CreateGraphics ( );
            Pen Red = new Pen ( Brushes.Red );
            Red.Width = 10.0F;
            Red.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
            dc.DrawRectangle ( Rednew Rectangle ( 55590285 ) );
            Red.Dispose ( );
        }
        /*============================================================*/
        protected override void OnPaint ( PaintEventArgs e ) {
            Moldura ( e );
            this.Size = new System.Drawing.Size ( 615335 );
            this.Text = "C# - PESQUISANDO E MARCANDO VOGAIS";
            this.BackColor = Color.White;
            Graphics dc = e.Graphics;
            Font myFont = new System.Drawing.Font ( "Consolas"12,
                FontStyle.Italic );
            Brush myBrush_1 = new SolidBrush ( Color.Red );
            dc.DrawString ( "C# - PESQUISANDO E MARCANDO VOGAIS",
                myFontmyBrush_115010 );
            Imprime_Array ( e );
            Informe ( e );
        }
        /*============================================================*/
        public Form1 ( ) {
            InitializeComponent ( );
        }
        /*============================================================*/

        private void Imprime_Array ( PaintEventArgs e ) {
            Graphics dc = e.Graphics;
            Font myFont = new System.Drawing.Font ( "Consolas"11,
                FontStyle.Italic );
            Brush myBrush_1 = new SolidBrush ( Color.Blue );

            for ( int i = 0i < 10i++ ) {
                for ( int j = 0j < 28j++ ) {
                    dc.DrawString ( "" + texto [ i ] [ j ], myFont,
                    myBrush_190 + ( j * 15 ), 43 + ( i * 17 ) );
                }
            }
        }

        /*============================================================*/
        private void Button1_Click ( object senderEventArgs e ) {
            System.Drawing.Graphics dc;
            dc = this.CreateGraphics ( );
            Font myFont = new System.Drawing.Font ( "Consolas"10,
                FontStyle.Italic );
            Brush myBrush_1 = new SolidBrush ( Color.Black );

            char [ ] busca;
            string str_2 = textBox1.Text;

            
        }
        /*============================================================*/
        private void Form1_Shown ( object senderEventArgs e ) {
            TextBox_1 ( 19024510010 );
            Label_1 ( 702458080"Digite uma vogal: " );
            Button_1 ( 3002453522"Ok" );
            Button_2 ( 5202605025"Sair" );
        }
        /*============================================================*/
        private void button2_Click ( object senderEventArgs e ) {
            Application.Exit ( );
        }
        /*============================================================*/
    }
}

Nenhum comentário:

Postar um comentário