24 Mayıs 2013 Cuma

C Sharp Uygulamalar Form Browser Application - Connect Google And Do Your Search on Google



KONU : C Sharp Uygulamalar - C Sharp ( C# ) formda browser uygulaması hazırlama.
ETİKETLER : csharp browser - csharp browser control - csharp browser component - csharp web browser control - csharp browser connection - c# browser - c# browser control - c# browser component .





UYGULAMAYI İNDİR



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

namespace C_Sharp_Form_WebBrowser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //Açmak istediğimiz sayfanın adresini girelim
            //bu fonksiyon çalıştığında tarayıcı penceresinde bu sayfa açılacak
          
            webBrowser1.Navigate("http://www.google.com");
        }

        private void GitButon_Click(object sender, EventArgs e)
        {
            //google anasayfaya git butonuna basıldığında
            //google ana sayfa tarayıcıda açılacak
         
            webBrowser1.Navigate("http://www.google.com");
        }

        private void AraButon_Click(object sender, EventArgs e)
        {
            //arama kutucuğuna yazılan kelime google da aratalım
            //ara butonuna basıldığında ara kutusunda yazılan kelime 
            //google ın arama kutusuna verelim
           
            foreach (HtmlElement el in webBrowser1.Document.All)
            {
                if (el.Name == "q")
                {
                    el.InnerText = anahtarKelimeTextBox.Text;
                }
            }

            //şimdi de google ın ara butonuna tıklayalım
           
            foreach (HtmlElement el in webBrowser1.Document.All)
            {
                if (el.Name == "btnG")
                {
                    el.InvokeMember("click");
                }
            }
        }

        #region Windows Form Designer generated code

        /// 
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// 
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.AraButon = new System.Windows.Forms.Button();
            this.anahtarKelimeTextBox = new System.Windows.Forms.TextBox();
            this.GitButon = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.webBrowser1);
            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.groupBox1.Location = new System.Drawing.Point(0, 0);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(657, 373);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Browser";
            // 
            // webBrowser1
            // 
            this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.webBrowser1.Location = new System.Drawing.Point(3, 16);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(651, 354);
            this.webBrowser1.TabIndex = 0;
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.AraButon);
            this.groupBox2.Controls.Add(this.anahtarKelimeTextBox);
            this.groupBox2.Controls.Add(this.GitButon);
            this.groupBox2.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.groupBox2.Location = new System.Drawing.Point(0, 373);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(657, 104);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Kontrol Panel";
            // 
            // AraButon
            // 
            this.AraButon.Location = new System.Drawing.Point(351, 49);
            this.AraButon.Name = "AraButon";
            this.AraButon.Size = new System.Drawing.Size(124, 23);
            this.AraButon.TabIndex = 2;
            this.AraButon.Text = "Google\'da Ara";
            this.AraButon.UseVisualStyleBackColor = true;
            this.AraButon.Click += new System.EventHandler(this.AraButon_Click);
            // 
            // anahtarKelimeTextBox
            // 
            this.anahtarKelimeTextBox.Location = new System.Drawing.Point(13, 49);
            this.anahtarKelimeTextBox.Name = "anahtarKelimeTextBox";
            this.anahtarKelimeTextBox.Size = new System.Drawing.Size(317, 20);
            this.anahtarKelimeTextBox.TabIndex = 1;
            // 
            // GitButon
            // 
            this.GitButon.Location = new System.Drawing.Point(12, 19);
            this.GitButon.Name = "GitButon";
            this.GitButon.Size = new System.Drawing.Size(147, 23);
            this.GitButon.TabIndex = 0;
            this.GitButon.Text = "Google AnaSayfaya Git";
            this.GitButon.UseVisualStyleBackColor = true;
            this.GitButon.Click += new System.EventHandler(this.GitButon_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(657, 477);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.groupBox2);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "Form1";
            this.Text = "Browser";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Button AraButon;
        private System.Windows.Forms.TextBox anahtarKelimeTextBox;
        private System.Windows.Forms.Button GitButon;
    }
}


UYGULAMAYI İNDİR

Hiç yorum yok :

Yorum Gönder