Jump to content

HTML Editor in Visual C#

- - - - -

  • Please log in to reply
No replies to this topic

#1
UbuntuX

UbuntuX

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
HTML Editor in Visual C#

Postby Ultragunner » Sat Mar 20, 2010 11:07 am
Features


HjsX Editor 0.1a (0.1a)(First version)
"Developed/Designed by Core
"(2010/09/02)

"Completely written in Visual C# 2008 (on .NET Framework 3.5 version)
"Used only .NET libraries
"Officially supported with HTML/XHTML/Javascript
"Load ,Save ,Pages
"Supported to Javascript(.js) ,HTML ,HTM Formats
"No Annoying Popup boxes
"Display the Saved Location on the status bar
"Cut,Copy,Paste,Select all Methods supported
"Can be changed the font color ,font family,font size,style
"About box
"Embedded Web Browser
"Only ask when closing if user didn't save well
"Custom Browsing

Main Form


    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 X_HtmlEditor

    {


        public partial class Form1 : Form

        {

            bool save_txtchange = true; //if true then file saves and if txtchange it false

            string file_name = "";


            public Form1()

            {

                InitializeComponent();

            }



            /******************************************

             *

             * NEW MENU

             *

             * *****************************************

             */


            private void newToolStripMenuItem_Click(object sender, EventArgs e)

            {

             

                //determine user saved the previous document

                if (save_txtchange == false) //false means need to be saved

                {

                    DialogResult diag_res;

                    diag_res = MessageBox.Show("Your current file has not been saved well \n\n Do you want to save it.?", "Confirm Box", MessageBoxButtons.YesNoCancel);


                    if (diag_res == DialogResult.Yes)

                    {

                        //call to the save dialogbox

                        saveasdialog_appear();

                    }


                    else if (diag_res == DialogResult.No)

                    {

                        //exit all documents and prepare to make a new document

                        txtmain.Clear();

                    }


                    else if (diag_res == DialogResult.Cancel)

                    {

                        //do nothing

                        return ;

                    }


                }


                else if (save_txtchange == true) //file has been already saved well

                {

                    //exit all documents and prepare to make a new document

                    txtmain.Clear();

                }

            }


            private void saveToolStripMenuItem_Click(object sender, EventArgs e)

            {

                 savedialog_appear();

            }


            private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)

            {

                saveasdialog_appear();

            }


            /**************************************************

             *

             * SAVE METHODS

             *

             * *************************************************

             */



            void savedialog_appear()

            {

                if (save_txtchange == false) //it means need to save

                {

                    if (file_name != "") //if exist something

                    {

                        txtmain.SaveFile(savediag.FileName, RichTextBoxStreamType.PlainText);

                        //display the saved location on bottom of status bar

                        stastatus.Text = "File Saved! ;";

                        stasaveloc.Text = "File Saved at : " + savediag.FileName;

                        Form1.ActiveForm.Text = "HjsX Editor";


                        save_txtchange = true; //true for next time

                    }


                    else if (file_name == "")

                    {

                        savediag.Title = "HjsX Editor";

                        savediag.Filter = "HTML|*.html|HTM|*.htm|Java Script|*.js";


                        if (savediag.ShowDialog() == DialogResult.OK)

                        {

                            //if okay then proceed

                            file_name = savediag.FileName;

                            txtmain.SaveFile(file_name, RichTextBoxStreamType.PlainText);


                            //display the saved location on bottom of status bar

                            stastatus.Text = "File Saved! ;";

                            stasaveloc.Text = "File Saved at : " + savediag.FileName;

                            Form1.ActiveForm.Text = "HjsX Editor";


                            save_txtchange = true; //true for next time

                        }

                    }


                    else

                    {

                        MessageBox.Show("invalid occurance");

                    }

                }

            }


             void saveasdialog_appear()

            {

                savediag.Title = "HjsX Editor";

                savediag.Filter = "HTML|*.html|HTM|*.htm|Java Script|*.js";


                if (savediag.ShowDialog() == DialogResult.OK)

                {

                    //if okay then proceed

                    file_name = savediag.FileName;

                    txtmain.SaveFile(file_name, RichTextBoxStreamType.PlainText);

                    stastatus.Text = "File Saved! ;";

                    stasaveloc.Text = "File Saved at : " + savediag.FileName;


                    save_txtchange = true; //true for next time

                }

            }


            //*************************************************

            //*************************************************



            private void openToolStripMenuItem_Click(object sender, EventArgs e)

            {

                opendiag.Title = "HjsX Editor";

                opendiag.Filter = "HTM|*.htm|HTML|*.html|Java Script|*.js";


                if (opendiag.ShowDialog() == DialogResult.OK)

                {

                    txtmain.LoadFile(opendiag.FileName, RichTextBoxStreamType.PlainText);

                }

            }


            private void exitToolStripMenuItem_Click(object sender, EventArgs e)

            {

                DialogResult msg_result;


                if (save_txtchange == false)

                {

                   msg_result= MessageBox.Show("file has not been saved \n\n Do you want to save.?", "Confirm Box",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Warning);


                   if (msg_result == DialogResult.Yes)

                   {

                       saveasdialog_appear(); //call to save dialog box to save

                   }


                   else if (msg_result == DialogResult.No)

                   {

                       Application.Exit();

                   }


                   else if (msg_result == DialogResult.Cancel)

                   {

                       return;

                   }

                }


            }


            /******************************************

             *

             * EDIT MENU

             *

             * *****************************************

             */


            private void cutToolStripMenuItem_Click(object sender, EventArgs e)

            {

                txtmain.Cut();

            }


            private void pasteToolStripMenuItem_Click(object sender, EventArgs e)

            {

                txtmain.Paste();

            }


            private void copyToolStripMenuItem_Click(object sender, EventArgs e)

            {

                txtmain.Copy();

            }


            private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)

            {

                txtmain.SelectAll();

            }


            private void fontColorToolStripMenuItem_Click(object sender, EventArgs e)

            {


                try

                {

                    if (fontdiag.ShowDialog() == DialogResult.OK)

                    {

                        //proceed if true (ok press)

                        txtmain.Font = fontdiag.Font;

                    }

                }

                catch (Exception error_var)

                {

                    MessageBox.Show("you selected " + fontdiag.Font.FontFamily + "\n\n" + error_var.Message);

                }

            }


            private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)

            {

                txtmain.WordWrap = true;

            }



            /******************************************

             *

             * ABOUT MENU

             *

             * *****************************************

             */



            private void aboutToolStripMenuItem_Click(object sender, EventArgs e)

            {

                MessageBox.Show("Made by Core 2010/02/08 \n\n Email Me: ubuntux@gmx.com", "About Me");

            }


            private void historyToolStripMenuItem_Click(object sender, EventArgs e)

            {

                MessageBox.Show("" +

                    "HjsX Editor 0.1a (0.1a)(First version) \n" +

    "Developed/Designed by Core\n" +

    "(2010/09/02)\n" +

    "\n" +

    "Completely written in Visual C# 2008 (on .NET Framework 3.5 version)\n" +

    "Used only .NET libraries\n" +

    "Officially supported with HTML/XHTML/Javascript\n" +

    "Load ,Save ,Pages\n" +

    "Supported to Javascript(.js) ,HTML ,HTM Formats\n" +

    "No Annoying Popup boxes\n" +

    "Display the Saved Location on the status bar\n" +

    "Cut,Copy,Paste,Select all Methods supported\n" +

    "Can be changed the font color ,font family,font size,style\n" +

    "About box\n" +

    "Embedded Web Browser\n" +

    "Only ask when closing if user didn't save well\n" +

    "Custom Browsing\n", "HjsX Editor History");


            }


             /******************************************

             *

             * FORM OPEN

             *

             * *****************************************

             */


            private void Form1_Load(object sender, EventArgs e)

            {

                txtmain.Font = new Font("new curior",16);

                txtmain.TextChanged += new EventHandler(runToolStripMenuItem_Click);

                this.SizeChanged += new EventHandler(size_change);

                txtmain.ContextMenuStrip  = ctxmenu;

                htmlmain.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(navigated_html);

                //text change method

                toolStrip1.BringToFront();

                toolStrip1.Show();

            }


            private void size_change(object sender, EventArgs e)

            {

                this.Refresh();

            }


             /******************************************

             *

             * DEBUG MENU

             *

             * *****************************************

             */


            private void runToolStripMenuItem_Click(object sender, EventArgs e)

            {

                //run the box

                if (file_name != "") //if file name exist

                {

                    tabPage2.Show();

                    htmlmain.Navigate(file_name,false);


                }

            }


             /******************************************

             *

             * txt Changed

             *

             * *****************************************

             */


            private void txtmain_TextChanged(object sender, EventArgs e)

            {

                if (save_txtchange == true)

                {

                    save_txtchange = false;

                    stastatus.Text = "*Attention File need to be saved! ;";

                    Form1.ActiveForm.Text = "HjsX Editor" + " *File Need to be saved";

                }

            }


            /**************************************************

             *

             * WEB BROWSER PAGE

             *

             * *************************************************

             */


            private void toolbtnhome_Click(object sender, EventArgs e)

            {

                //go to first page

                htmlmain.Navigate(file_name, false);


            }


            private void toolbtnback_Click(object sender, EventArgs e)

            {

                htmlmain.GoBack();


            }


            private void toolbtnnext_Click(object sender, EventArgs e)

            {

                htmlmain.GoForward();

            }




            private void toolbtngo_Click(object sender, EventArgs e)

            {

                if (tooltxt.Text.Contains("http://"))

                {

                    string href_loc;

                    href_loc = tooltxt.Text;

                    htmlmain.Navigate(href_loc, false);

                }


                else

                {

                    MessageBox.Show("You need to type a valid URL \n\n like http://google.com or ftp://microsoft.com");

                }

            }


            private void navigated_html(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e)

            {

                tooltxt.Text = htmlmain.Document.Url.ToString();

            }


            /********************************

           

             context menu strip


            ********************************

            */


            private void cutToolStripMenuItem1_Click(object sender, EventArgs e)

            {

                txtmain.Cut();

            }


            private void copyToolStripMenuItem1_Click(object sender, EventArgs e)

            {

                txtmain.Copy();

            }


            private void pasteToolStripMenuItem1_Click(object sender, EventArgs e)

            {

                txtmain.Paste();

            }


        }

    }


Designer Code


    namespace X_HtmlEditor

    {

        partial class Form1

        {

            /// <summary>

            /// Required designer variable.

            /// </summary>

            private System.ComponentModel.IContainer components = null;


            /// <summary>

            /// Clean up any resources being used.

            /// </summary>

            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

            protected override void Dispose(bool disposing)

            {

                if (disposing && (components != null))

                {

                    components.Dispose();

                }

                base.Dispose(disposing);

            }


            #region Windows Form Designer generated code


            /// <summary>

            /// Required method for Designer support - do not modify

            /// the contents of this method with the code editor.

            /// </summary>

            private void InitializeComponent()

            {

                this.components = new System.ComponentModel.Container();

                this.tabControl1 = new System.Windows.Forms.TabControl();

                this.tabPage1 = new System.Windows.Forms.TabPage();

                this.txtmain = new System.Windows.Forms.RichTextBox();

                this.tabPage2 = new System.Windows.Forms.TabPage();

                this.toolStrip1 = new System.Windows.Forms.ToolStrip();

                this.toolbtnhome = new System.Windows.Forms.ToolStripButton();

                this.toolbtnback = new System.Windows.Forms.ToolStripButton();

                this.toolbtnnext = new System.Windows.Forms.ToolStripButton();

                this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();

                this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();

                this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();

                this.tooltxt = new System.Windows.Forms.ToolStripTextBox();

                this.toolbtngo = new System.Windows.Forms.ToolStripButton();

                this.htmlmain = new System.Windows.Forms.WebBrowser();

                this.menuStrip1 = new System.Windows.Forms.MenuStrip();

                this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();

                this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.wordWrapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();

                this.fontColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.historyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

                this.savediag = new System.Windows.Forms.SaveFileDialog();

                this.opendiag = new System.Windows.Forms.OpenFileDialog();

                this.fontdiag = new System.Windows.Forms.FontDialog();

                this.stastrip = new System.Windows.Forms.StatusStrip();

                this.stastatus = new System.Windows.Forms.ToolStripStatusLabel();

                this.stasaveloc = new System.Windows.Forms.ToolStripStatusLabel();

                this.ctxmenu = new System.Windows.Forms.ContextMenuStrip(this.components);

                this.cutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();

                this.copyToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();

                this.pasteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();

                this.tabControl1.SuspendLayout();

                this.tabPage1.SuspendLayout();

                this.tabPage2.SuspendLayout();

                this.toolStrip1.SuspendLayout();

                this.menuStrip1.SuspendLayout();

                this.stastrip.SuspendLayout();

                this.ctxmenu.SuspendLayout();

                this.SuspendLayout();

                //

                // tabControl1

                //

                this.tabControl1.Controls.Add(this.tabPage1);

                this.tabControl1.Controls.Add(this.tabPage2);

                this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;

                this.tabControl1.Location = new System.Drawing.Point(0, 29);

                this.tabControl1.Margin = new System.Windows.Forms.Padding(5);

                this.tabControl1.Name = "tabControl1";

                this.tabControl1.SelectedIndex = 0;

                this.tabControl1.Size = new System.Drawing.Size(584, 393);

                this.tabControl1.TabIndex = 0;

                //

                // tabPage1

                //

                this.tabPage1.Controls.Add(this.txtmain);

                this.tabPage1.Location = new System.Drawing.Point(4, 27);

                this.tabPage1.Margin = new System.Windows.Forms.Padding(5);

                this.tabPage1.Name = "tabPage1";

                this.tabPage1.Padding = new System.Windows.Forms.Padding(5);

                this.tabPage1.Size = new System.Drawing.Size(576, 362);

                this.tabPage1.TabIndex = 0;

                this.tabPage1.Text = "Editor";

                this.tabPage1.UseVisualStyleBackColor = true;

                //

                // txtmain

                //

                this.txtmain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

                            | System.Windows.Forms.AnchorStyles.Left)

                            | System.Windows.Forms.AnchorStyles.Right)));

                this.txtmain.BorderStyle = System.Windows.Forms.BorderStyle.None;

                this.txtmain.Location = new System.Drawing.Point(5, 5);

                this.txtmain.Margin = new System.Windows.Forms.Padding(5);

                this.txtmain.Name = "txtmain";

                this.txtmain.Size = new System.Drawing.Size(566, 334);

                this.txtmain.TabIndex = 0;

                this.txtmain.Text = "";

                this.txtmain.TextChanged += new System.EventHandler(this.txtmain_TextChanged);

                //

                // tabPage2

                //

                this.tabPage2.Controls.Add(this.toolStrip1);

                this.tabPage2.Controls.Add(this.htmlmain);

                this.tabPage2.Location = new System.Drawing.Point(4, 27);

                this.tabPage2.Margin = new System.Windows.Forms.Padding(5);

                this.tabPage2.Name = "tabPage2";

                this.tabPage2.Padding = new System.Windows.Forms.Padding(5);

                this.tabPage2.Size = new System.Drawing.Size(576, 362);

                this.tabPage2.TabIndex = 1;

                this.tabPage2.Text = "Viewer";

                this.tabPage2.UseVisualStyleBackColor = true;

                //

                // toolStrip1

                //

                this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;

                this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.toolbtnhome,

                this.toolbtnback,

                this.toolbtnnext,

                this.toolStripSeparator1,

                this.toolStripLabel1,

                this.toolStripLabel2,

                this.tooltxt,

                this.toolbtngo});

                this.toolStrip1.Location = new System.Drawing.Point(5, 5);

                this.toolStrip1.Name = "toolStrip1";

                this.toolStrip1.Size = new System.Drawing.Size(566, 57);

                this.toolStrip1.TabIndex = 3;

                this.toolStrip1.Text = "toolStrip1";

                this.toolStrip1.Visible = false;

                //

                // toolbtnhome

                //

                this.toolbtnhome.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

                this.toolbtnhome.Image = global::X_HtmlEditor.Properties.Resources.home_arrow;

                this.toolbtnhome.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;

                this.toolbtnhome.ImageTransparentColor = System.Drawing.Color.Magenta;

                this.toolbtnhome.Name = "toolbtnhome";

                this.toolbtnhome.Size = new System.Drawing.Size(52, 54);

                this.toolbtnhome.Text = "toolStripButton1";

                this.toolbtnhome.ToolTipText = "Home";

                this.toolbtnhome.Click += new System.EventHandler(this.toolbtnhome_Click);

                //

                // toolbtnback

                //

                this.toolbtnback.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

                this.toolbtnback.Image = global::X_HtmlEditor.Properties.Resources.back_arrow;

                this.toolbtnback.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;

                this.toolbtnback.ImageTransparentColor = System.Drawing.Color.Magenta;

                this.toolbtnback.Name = "toolbtnback";

                this.toolbtnback.Size = new System.Drawing.Size(52, 54);

                this.toolbtnback.Text = "toolStripButton2";

                this.toolbtnback.ToolTipText = "Back";

                this.toolbtnback.Click += new System.EventHandler(this.toolbtnback_Click);

                //

                // toolbtnnext

                //

                this.toolbtnnext.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

                this.toolbtnnext.Image = global::X_HtmlEditor.Properties.Resources.next_arrow;

                this.toolbtnnext.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;

                this.toolbtnnext.ImageTransparentColor = System.Drawing.Color.Magenta;

                this.toolbtnnext.Name = "toolbtnnext";

                this.toolbtnnext.Size = new System.Drawing.Size(54, 54);

                this.toolbtnnext.Text = "toolStripButton3";

                this.toolbtnnext.ToolTipText = "Next";

                this.toolbtnnext.Click += new System.EventHandler(this.toolbtnnext_Click);

                //

                // toolStripSeparator1

                //

                this.toolStripSeparator1.Name = "toolStripSeparator1";

                this.toolStripSeparator1.Size = new System.Drawing.Size(6, 57);

                //

                // toolStripLabel1

                //

                this.toolStripLabel1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;

                this.toolStripLabel1.Name = "toolStripLabel1";

                this.toolStripLabel1.Size = new System.Drawing.Size(28, 54);

                this.toolStripLabel1.Text = "URL";

                //

                // toolStripLabel2

                //

                this.toolStripLabel2.Name = "toolStripLabel2";

                this.toolStripLabel2.Size = new System.Drawing.Size(10, 54);

                this.toolStripLabel2.Text = ":";

                //

                // tooltxt

                //

                this.tooltxt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;

                this.tooltxt.Name = "tooltxt";

                this.tooltxt.Size = new System.Drawing.Size(300, 57);

                this.tooltxt.ToolTipText = "URL";

                //

                // toolbtngo

                //

                this.toolbtngo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

                this.toolbtngo.Image = global::X_HtmlEditor.Properties.Resources.go;

                this.toolbtngo.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;

                this.toolbtngo.ImageTransparentColor = System.Drawing.Color.Magenta;

                this.toolbtngo.Name = "toolbtngo";

                this.toolbtngo.Size = new System.Drawing.Size(40, 54);

                this.toolbtngo.Text = "toolStripButton1";

                this.toolbtngo.ToolTipText = "Go";

                this.toolbtngo.Click += new System.EventHandler(this.toolbtngo_Click);

                //

                // htmlmain

                //

                this.htmlmain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

                            | System.Windows.Forms.AnchorStyles.Left)

                            | System.Windows.Forms.AnchorStyles.Right)));

                this.htmlmain.Location = new System.Drawing.Point(0, 64);

                this.htmlmain.Margin = new System.Windows.Forms.Padding(5);

                this.htmlmain.MinimumSize = new System.Drawing.Size(27, 28);

                this.htmlmain.Name = "htmlmain";

                this.htmlmain.Size = new System.Drawing.Size(574, 275);

                this.htmlmain.TabIndex = 0;

                this.htmlmain.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.navigated_html);

                //

                // menuStrip1

                //

                this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.fileToolStripMenuItem,

                this.editToolStripMenuItem,

                this.debugToolStripMenuItem,

                this.helpToolStripMenuItem});

                this.menuStrip1.Location = new System.Drawing.Point(0, 0);

                this.menuStrip1.Name = "menuStrip1";

                this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 4, 0, 4);

                this.menuStrip1.Size = new System.Drawing.Size(584, 29);

                this.menuStrip1.TabIndex = 1;

                this.menuStrip1.Text = "menuStrip1";

                //

                // fileToolStripMenuItem

                //

                this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.newToolStripMenuItem,

                this.saveToolStripMenuItem,

                this.saveAsToolStripMenuItem,

                this.openToolStripMenuItem,

                this.toolStripMenuItem1,

                this.exitToolStripMenuItem});

                this.fileToolStripMenuItem.Font = new System.Drawing.Font("Comic Sans MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";

                this.fileToolStripMenuItem.Size = new System.Drawing.Size(41, 21);

                this.fileToolStripMenuItem.Text = "&File";

                //

                // newToolStripMenuItem

                //

                this.newToolStripMenuItem.Name = "newToolStripMenuItem";

                this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));

                this.newToolStripMenuItem.Size = new System.Drawing.Size(208, 22);

                this.newToolStripMenuItem.Text = "&New";

                this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);

                //

                // saveToolStripMenuItem

                //

                this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";

                this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));

                this.saveToolStripMenuItem.Size = new System.Drawing.Size(208, 22);

                this.saveToolStripMenuItem.Text = "&Save";

                this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);

                //

                // saveAsToolStripMenuItem

                //

                this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";

                this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)

                            | System.Windows.Forms.Keys.S)));

                this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(208, 22);

                this.saveAsToolStripMenuItem.Text = "&Save as...";

                this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);

                //

                // openToolStripMenuItem

                //

                this.openToolStripMenuItem.Name = "openToolStripMenuItem";

                this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));

                this.openToolStripMenuItem.Size = new System.Drawing.Size(208, 22);

                this.openToolStripMenuItem.Text = "&Open...";

                this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);

                //

                // toolStripMenuItem1

                //

                this.toolStripMenuItem1.Name = "toolStripMenuItem1";

                this.toolStripMenuItem1.Size = new System.Drawing.Size(205, 6);

                //

                // exitToolStripMenuItem

                //

                this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";

                this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q)));

                this.exitToolStripMenuItem.Size = new System.Drawing.Size(208, 22);

                this.exitToolStripMenuItem.Text = "Exit";

                this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);

                //

                // editToolStripMenuItem

                //

                this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.cutToolStripMenuItem,

                this.copyToolStripMenuItem,

                this.pasteToolStripMenuItem,

                this.selectAllToolStripMenuItem,

                this.wordWrapToolStripMenuItem,

                this.toolStripMenuItem2,

                this.fontColorToolStripMenuItem});

                this.editToolStripMenuItem.Font = new System.Drawing.Font("Comic Sans MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                this.editToolStripMenuItem.Name = "editToolStripMenuItem";

                this.editToolStripMenuItem.Size = new System.Drawing.Size(44, 21);

                this.editToolStripMenuItem.Text = "&Edit";

                //

                // cutToolStripMenuItem

                //

                this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";

                this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));

                this.cutToolStripMenuItem.Size = new System.Drawing.Size(221, 22);

                this.cutToolStripMenuItem.Text = "&Cut";

                this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);

                //

                // copyToolStripMenuItem

                //

                this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";

                this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));

                this.copyToolStripMenuItem.Size = new System.Drawing.Size(221, 22);

                this.copyToolStripMenuItem.Text = "&Copy";

                this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);

                //

                // pasteToolStripMenuItem

                //

                this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";

                this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));

                this.pasteToolStripMenuItem.Size = new System.Drawing.Size(221, 22);

                this.pasteToolStripMenuItem.Text = "&Paste";

                this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);

                //

                // selectAllToolStripMenuItem

                //

                this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";

                this.selectAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));

                this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(221, 22);

                this.selectAllToolStripMenuItem.Text = "&Select all";

                this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click);

                //

                // wordWrapToolStripMenuItem

                //

                this.wordWrapToolStripMenuItem.Name = "wordWrapToolStripMenuItem";

                this.wordWrapToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)

                            | System.Windows.Forms.Keys.W)));

                this.wordWrapToolStripMenuItem.Size = new System.Drawing.Size(221, 22);

                this.wordWrapToolStripMenuItem.Text = "&Word wrap";

                this.wordWrapToolStripMenuItem.Click += new System.EventHandler(this.wordWrapToolStripMenuItem_Click);

                //

                // toolStripMenuItem2

                //

                this.toolStripMenuItem2.Name = "toolStripMenuItem2";

                this.toolStripMenuItem2.Size = new System.Drawing.Size(218, 6);

                //

                // fontColorToolStripMenuItem

                //

                this.fontColorToolStripMenuItem.Name = "fontColorToolStripMenuItem";

                this.fontColorToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));

                this.fontColorToolStripMenuItem.Size = new System.Drawing.Size(221, 22);

                this.fontColorToolStripMenuItem.Text = "&Font change";

                this.fontColorToolStripMenuItem.Click += new System.EventHandler(this.fontColorToolStripMenuItem_Click);

                //

                // debugToolStripMenuItem

                //

                this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.runToolStripMenuItem});

                this.debugToolStripMenuItem.Font = new System.Drawing.Font("Comic Sans MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";

                this.debugToolStripMenuItem.Size = new System.Drawing.Size(53, 21);

                this.debugToolStripMenuItem.Text = "&Debug";

                //

                // runToolStripMenuItem

                //

                this.runToolStripMenuItem.Name = "runToolStripMenuItem";

                this.runToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));

                this.runToolStripMenuItem.Size = new System.Drawing.Size(139, 22);

                this.runToolStripMenuItem.Text = "&Run";

                this.runToolStripMenuItem.Click += new System.EventHandler(this.runToolStripMenuItem_Click);

                //

                // helpToolStripMenuItem

                //

                this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.historyToolStripMenuItem,

                this.aboutToolStripMenuItem});

                this.helpToolStripMenuItem.Font = new System.Drawing.Font("Comic Sans MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";

                this.helpToolStripMenuItem.Size = new System.Drawing.Size(45, 21);

                this.helpToolStripMenuItem.Text = "&Help";

                //

                // historyToolStripMenuItem

                //

                this.historyToolStripMenuItem.Name = "historyToolStripMenuItem";

                this.historyToolStripMenuItem.Size = new System.Drawing.Size(154, 22);

                this.historyToolStripMenuItem.Text = "&History";

                this.historyToolStripMenuItem.Click += new System.EventHandler(this.historyToolStripMenuItem_Click);

                //

                // aboutToolStripMenuItem

                //

                this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";

                this.aboutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.H)));

                this.aboutToolStripMenuItem.Size = new System.Drawing.Size(154, 22);

                this.aboutToolStripMenuItem.Text = "&About";

                this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);

                //

                // opendiag

                //

                this.opendiag.FileName = "openFileDialog1";

                //

                // stastrip

                //

                this.stastrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.stastatus,

                this.stasaveloc});

                this.stastrip.Location = new System.Drawing.Point(0, 400);

                this.stastrip.Name = "stastrip";

                this.stastrip.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);

                this.stastrip.Size = new System.Drawing.Size(584, 22);

                this.stastrip.TabIndex = 2;

                this.stastrip.Text = "statusStrip1";

                //

                // stastatus

                //

                this.stastatus.Name = "stastatus";

                this.stastatus.Size = new System.Drawing.Size(66, 17);

                this.stastatus.Text = "StBarStatus";

                //

                // stasaveloc

                //

                this.stasaveloc.Name = "stasaveloc";

                this.stasaveloc.Size = new System.Drawing.Size(80, 17);

                this.stasaveloc.Text = "StBarLocation";

                //

                // ctxmenu

                //

                this.ctxmenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

                this.cutToolStripMenuItem1,

                this.copyToolStripMenuItem1,

                this.pasteToolStripMenuItem1});

                this.ctxmenu.Name = "ctxmenu";

                this.ctxmenu.Size = new System.Drawing.Size(103, 70);

                //

                // cutToolStripMenuItem1

                //

                this.cutToolStripMenuItem1.Name = "cutToolStripMenuItem1";

                this.cutToolStripMenuItem1.Size = new System.Drawing.Size(102, 22);

                this.cutToolStripMenuItem1.Text = "Cut";

                this.cutToolStripMenuItem1.Click += new System.EventHandler(this.cutToolStripMenuItem1_Click);

                //

                // copyToolStripMenuItem1

                //

                this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1";

                this.copyToolStripMenuItem1.Size = new System.Drawing.Size(102, 22);

                this.copyToolStripMenuItem1.Text = "Copy";

                this.copyToolStripMenuItem1.Click += new System.EventHandler(this.copyToolStripMenuItem1_Click);

                //

                // pasteToolStripMenuItem1

                //

                this.pasteToolStripMenuItem1.Name = "pasteToolStripMenuItem1";

                this.pasteToolStripMenuItem1.Size = new System.Drawing.Size(102, 22);

                this.pasteToolStripMenuItem1.Text = "Paste";

                this.pasteToolStripMenuItem1.Click += new System.EventHandler(this.pasteToolStripMenuItem1_Click);

                //

                // Form1

                //

                this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);

                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

                this.ClientSize = new System.Drawing.Size(584, 422);

                this.Controls.Add(this.stastrip);

                this.Controls.Add(this.tabControl1);

                this.Controls.Add(this.menuStrip1);

                this.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                this.MainMenuStrip = this.menuStrip1;

                this.Margin = new System.Windows.Forms.Padding(5);

                this.Name = "Form1";

                this.Text = "HjsX Editor";

                this.Load += new System.EventHandler(this.Form1_Load);

                this.tabControl1.ResumeLayout(false);

                this.tabPage1.ResumeLayout(false);

                this.tabPage2.ResumeLayout(false);

                this.tabPage2.PerformLayout();

                this.toolStrip1.ResumeLayout(false);

                this.toolStrip1.PerformLayout();

                this.menuStrip1.ResumeLayout(false);

                this.menuStrip1.PerformLayout();

                this.stastrip.ResumeLayout(false);

                this.stastrip.PerformLayout();

                this.ctxmenu.ResumeLayout(false);

                this.ResumeLayout(false);

                this.PerformLayout();


            }


            #endregion


            private System.Windows.Forms.TabControl tabControl1;

            private System.Windows.Forms.TabPage tabPage1;

            private System.Windows.Forms.TabPage tabPage2;

            private System.Windows.Forms.WebBrowser htmlmain;

            private System.Windows.Forms.MenuStrip menuStrip1;

            private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;

            private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;

            private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;

            private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;

            private System.Windows.Forms.ToolStripMenuItem fontColorToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;

            private System.Windows.Forms.SaveFileDialog savediag;

            private System.Windows.Forms.OpenFileDialog opendiag;

            private System.Windows.Forms.RichTextBox txtmain;

            private System.Windows.Forms.FontDialog fontdiag;

            private System.Windows.Forms.ToolStripMenuItem wordWrapToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;

            private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem;

            private System.Windows.Forms.StatusStrip stastrip;

            private System.Windows.Forms.ToolStripStatusLabel stasaveloc;

            private System.Windows.Forms.ToolStripStatusLabel stastatus;

            private System.Windows.Forms.ToolStrip toolStrip1;

            private System.Windows.Forms.ToolStripButton toolbtnhome;

            private System.Windows.Forms.ToolStripButton toolbtnback;

            private System.Windows.Forms.ToolStripButton toolbtnnext;

            private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;

            private System.Windows.Forms.ToolStripLabel toolStripLabel1;

            private System.Windows.Forms.ToolStripLabel toolStripLabel2;

            private System.Windows.Forms.ToolStripTextBox tooltxt;




Program.CS


    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Windows.Forms;


    namespace X_HtmlEditor

    {

        static class Program

        {

            /// <summary>

            /// The main entry point for the application.

            /// </summary>

            [STAThread]

            static void Main()

            {

                Application.EnableVisualStyles();

                Application.SetCompatibleTextRenderingDefault(false);

                Application.Run(new Form1());

            }

        }

    }

The Original Source :
Ensembles Group • View topic - HTML Editor in Visual C#
(this is my site :closedeyes: )




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users