sexta-feira, 18 de junho de 2021

C# - Marcando ocorrências de múltiplos


A primeira versão deste programa,
foi criada em C++ com o Qt,
e me lembro que me deu bastante trabalho,
porque não é simplesmente pesquisar
os múltiplos, se fosse só isto seria muito fácil,
mas o que agente queria mesmo era marcar
as ocorrências usando um bitimap como fundo;
Depois de várias cabeçadas nós conseguimos,
e depois criemos outra versão no C++ Builder,
ainda em C++, e agora aproveitando um pouco
do tempo que nos sobrou fizemos o mesmo programa
em C# usando o VS Studio da microsoft. 
Veja no vídeo ele funcionando.




        /*============================================================*/
        void Informe ( PaintEventArgs e ) {
            Graphics dc = e.Graphics;
            Font myFont = new System.Drawing.Font ( "Helvetica", 11,
                FontStyle.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: ", myFont, myBrush_1, 350, 300 );
            dc.DrawString ( "Samuel Lima ", myFont, myBrush_2, 380, 300 );
            dc.DrawString ( "sa_sp10@hotmail.com ", myFont, myBrush_3, 350, 315 );
        }
        /*============================================================*/
        private void Paint_Imagem ( PaintEventArgs e ) {
            Image newImage = Image.FromFile ( "Moldura_7.bmp" );
            Point ulCorner = new Point ( 0, 0 );
            e.Graphics.DrawImage ( newImage, ulCorner );
        }
        /*============================================================*/
        protected override void OnPaint ( PaintEventArgs e ) {
            Paint_Imagem ( e );
            this.Size = new System.Drawing.Size ( 615, 379 );
            this.Text = "C# - MÚLTIPLOS MARCANDO OCORRÊNCIAS";
            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# - MÚLTIPLOS MARCANDO OCORRÊNCIAS",
                myFont, myBrush_1, 130, 15 );
            Informe ( e );
        }
        /*============================================================*/
        void FlowLayoutPanel_1 ( int X, int Y, int W, int H ) {
            flowLayoutPanel1.AutoScroll = true;
            this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.flowLayoutPanel1.Font = new System.Drawing.Font ( "Microsoft Sans Serif",
            8F, System.Drawing.FontStyle.Italic,
            System.Drawing.GraphicsUnit.Point, ( ( byte ) ( 0 ) ) );
            this.flowLayoutPanel1.ForeColor = System.Drawing.Color.Blue;
            this.flowLayoutPanel1.Location = new System.Drawing.Point ( X, Y );
            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
            this.flowLayoutPanel1.Size = new System.Drawing.Size ( W, H );
            this.flowLayoutPanel1.TabIndex = 2;
        }
        /*============================================================*/
        void TextBox_1 ( int X, int Y, int W, int H ) {
            //this.label1.AutoSize = true;
            textBox1.Font = new System.Drawing.Font ( "Microsoft Sans Serif",
            8F, System.Drawing.FontStyle.Italic,
            System.Drawing.GraphicsUnit.Point, ( ( byte ) ( 0 ) ) );
            textBox1.ForeColor = System.Drawing.Color.Blue;
            textBox1.Location = new System.Drawing.Point ( X, Y );
            textBox1.Name = "textBox1";
            textBox1.Size = new System.Drawing.Size ( W, H );
            textBox1.TabIndex = 3;
        }
        /*============================================================*/
        void Label_1 ( int X, int Y, int W, int H, string st ) {
            //this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font ( "Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Italic, 
System.Drawing.GraphicsUnit.Point, ( ( byte ) ( 0 ) ) );
            this.label1.ForeColor = System.Drawing.Color.Blue;
            this.label1.Location = new System.Drawing.Point ( X, Y );
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size ( W, H );
            this.label1.TabIndex = 3;
            this.label1.Text += st;
        }
        /*============================================================*/
        public Form1 ( ) {
            InitializeComponent ( );
        }
        /*============================================================*/
        public void Button_1 ( int X, int Y, int W, int H, string st ) {
            button1.Location = new Point ( X, Y );
            this.button1.Size = new System.Drawing.Size ( W, H );
            button1.Font = new Font ( "Times New Roman", 10F,
             System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, 0 );
            button1.BackColor = Color.Pink;
            button1.ForeColor = Color.FromArgb ( 0, 0, 0 );
            this.button1.Text = st;
        }
        /*============================================================*/

Nenhum comentário:

Postar um comentário