Treceți la conținutul principal

openfile cs

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace OpenFile
{
 /// <summary>
 /// Summary description for Form1.
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.MainMenu mainMenu1;
  private System.Windows.Forms.MenuItem menuItem1;
  private System.Windows.Forms.MenuItem menuItem2;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.MenuItem menuItem3;
  private System.Windows.Forms.MenuItem menuItem4;
  private System.Windows.Forms.MenuItem menuItem5;
  private System.Windows.Forms.MenuItem menuItem6;
  private System.Windows.Forms.MenuItem menuItem7;
  private System.Windows.Forms.MenuItem menuItem9;
  private System.Windows.Forms.MenuItem menuItem10;
  private System.Windows.Forms.MenuItem menuItem11;
  private System.Windows.Forms.MenuItem menuItem8;
  private System.Windows.Forms.MenuItem menuItem12;
  private System.Windows.Forms.MenuItem menuItem13;
  private System.Windows.Forms.MenuItem menuItem14;
  private System.Windows.Forms.MenuItem menuItem15;
  private System.Windows.Forms.MenuItem menuItem16;
  private System.Windows.Forms.MenuItem menuItem17;
  private System.Windows.Forms.MenuItem menuItem18;
  private System.Windows.Forms.MenuItem menuItem19;
  private System.Windows.Forms.MenuItem menuItem20;
  private System.Windows.Forms.MenuItem menuItem21;
  private System.Windows.Forms.MenuItem menuItem22;
  private System.Windows.Forms.MenuItem menuItem23;
  private System.Windows.Forms.MenuItem menuItem24;
  private System.Windows.Forms.MenuItem menuItem25;
  private System.Windows.Forms.MenuItem menuItem26;
  private System.Windows.Forms.MenuItem menuItem27;
  private System.Windows.Forms.MenuItem menuItem28;
  private System.Windows.Forms.MenuItem menuItem29;
  private System.Windows.Forms.MenuItem menuItem30;
  private System.Windows.Forms.MenuItem menuItem31;
  private System.Windows.Forms.MenuItem menuItem32;
  private System.Windows.Forms.MenuItem menuItem33;
  private System.Windows.Forms.MenuItem menuItem34;
  private System.Windows.Forms.MenuItem menuItem35;
  private System.Windows.Forms.MenuItem menuItem36;
  private System.Windows.Forms.MenuItem menuItem37;
  private System.Windows.Forms.MenuItem menuItem38;
  private System.Windows.Forms.MenuItem menuItem39;
  private System.Windows.Forms.MenuItem menuItem40;
  private System.Windows.Forms.MenuItem menuItem41;
  private System.Windows.Forms.MenuItem menuItem42;
  private System.Windows.Forms.MenuItem menuItem43;
  private System.Windows.Forms.MenuItem menuItem44;
  private System.Windows.Forms.MenuItem menuItem45;
  private System.Windows.Forms.MenuItem menuItem46;
  private System.Windows.Forms.MenuItem menuItem47;
  /// <summary>
  /// Required designer variable.
  /// </summary>
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   //
   // Required for Windows Form Designer support
   //
   InitializeComponent();

   //
   // TODO: Add any constructor code after InitializeComponent call
   //
  }

  /// <summary>
  /// Clean up any resources being used.
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (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.mainMenu1 = new System.Windows.Forms.MainMenu();
   this.menuItem1 = new System.Windows.Forms.MenuItem();
   this.menuItem2 = new System.Windows.Forms.MenuItem();
   this.menuItem13 = new System.Windows.Forms.MenuItem();
   this.menuItem15 = new System.Windows.Forms.MenuItem();
   this.menuItem14 = new System.Windows.Forms.MenuItem();
   this.menuItem3 = new System.Windows.Forms.MenuItem();
   this.menuItem4 = new System.Windows.Forms.MenuItem();
   this.menuItem7 = new System.Windows.Forms.MenuItem();
   this.menuItem5 = new System.Windows.Forms.MenuItem();
   this.menuItem6 = new System.Windows.Forms.MenuItem();
   this.menuItem9 = new System.Windows.Forms.MenuItem();
   this.menuItem10 = new System.Windows.Forms.MenuItem();
   this.menuItem11 = new System.Windows.Forms.MenuItem();
   this.menuItem8 = new System.Windows.Forms.MenuItem();
   this.menuItem12 = new System.Windows.Forms.MenuItem();
   this.menuItem16 = new System.Windows.Forms.MenuItem();
   this.menuItem17 = new System.Windows.Forms.MenuItem();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.menuItem18 = new System.Windows.Forms.MenuItem();
   this.menuItem19 = new System.Windows.Forms.MenuItem();
   this.menuItem20 = new System.Windows.Forms.MenuItem();
   this.menuItem21 = new System.Windows.Forms.MenuItem();
   this.menuItem22 = new System.Windows.Forms.MenuItem();
   this.menuItem23 = new System.Windows.Forms.MenuItem();
   this.menuItem24 = new System.Windows.Forms.MenuItem();
   this.menuItem25 = new System.Windows.Forms.MenuItem();
   this.menuItem26 = new System.Windows.Forms.MenuItem();
   this.menuItem27 = new System.Windows.Forms.MenuItem();
   this.menuItem28 = new System.Windows.Forms.MenuItem();
   this.menuItem29 = new System.Windows.Forms.MenuItem();
   this.menuItem30 = new System.Windows.Forms.MenuItem();
   this.menuItem31 = new System.Windows.Forms.MenuItem();
   this.menuItem32 = new System.Windows.Forms.MenuItem();
   this.menuItem33 = new System.Windows.Forms.MenuItem();
   this.menuItem34 = new System.Windows.Forms.MenuItem();
   this.menuItem35 = new System.Windows.Forms.MenuItem();
   this.menuItem36 = new System.Windows.Forms.MenuItem();
   this.menuItem37 = new System.Windows.Forms.MenuItem();
   this.menuItem38 = new System.Windows.Forms.MenuItem();
   this.menuItem39 = new System.Windows.Forms.MenuItem();
   this.menuItem40 = new System.Windows.Forms.MenuItem();
   this.menuItem41 = new System.Windows.Forms.MenuItem();
   this.menuItem42 = new System.Windows.Forms.MenuItem();
   this.menuItem43 = new System.Windows.Forms.MenuItem();
   this.menuItem44 = new System.Windows.Forms.MenuItem();
   this.menuItem45 = new System.Windows.Forms.MenuItem();
   this.menuItem46 = new System.Windows.Forms.MenuItem();
   this.menuItem47 = new System.Windows.Forms.MenuItem();
   this.SuspendLayout();
   // 
   // mainMenu1
   // 
   this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                       this.menuItem1,
                       this.menuItem4,
                       this.menuItem18,
                       this.menuItem16,
                       this.menuItem8});
   // 
   // menuItem1
   // 
   this.menuItem1.Index = 0;
   this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                       this.menuItem24,
                       this.menuItem2,
                       this.menuItem13,
                       this.menuItem15,
                       this.menuItem14,
                       this.menuItem3,
                       this.menuItem26,
                       this.menuItem27,
                       this.menuItem28});
   this.menuItem1.Text = "File";
   // 
   // menuItem2
   // 
   this.menuItem2.Index = 1;
   this.menuItem2.Text = "Open";
   this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
   // 
   // menuItem13
   // 
   this.menuItem13.Index = 2;
   this.menuItem13.Text = "Save";
   this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
   // 
   // menuItem15
   // 
   this.menuItem15.Index = 3;
   this.menuItem15.Text = "SaveAs...";
   this.menuItem15.Click += new System.EventHandler(this.menuItem15_Click);
   // 
   // menuItem14
   // 
   this.menuItem14.Index = 4;
   this.menuItem14.Text = "Close";
   this.menuItem14.Click += new System.EventHandler(this.menuItem14_Click);
   // 
   // menuItem3
   // 
   this.menuItem3.Index = 5;
   this.menuItem3.Text = "Exit";
   this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
   // 
   // menuItem4
   // 
   this.menuItem4.Index = 1;
   this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                       this.menuItem7,
                       this.menuItem5,
                       this.menuItem6,
                       this.menuItem9,
                       this.menuItem10,
                       this.menuItem11,
                       this.menuItem29,
                       this.menuItem30,
                       this.menuItem31,
                       this.menuItem32});
   this.menuItem4.Text = "Edit";
   // 
   // menuItem7
   // 
   this.menuItem7.Index = 0;
   this.menuItem7.Text = "Undo";
   this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
   // 
   // menuItem5
   // 
   this.menuItem5.Index = 1;
   this.menuItem5.Text = "Cut";
   this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
   // 
   // menuItem6
   // 
   this.menuItem6.Index = 2;
   this.menuItem6.Text = "Copy";
   this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
   // 
   // menuItem9
   // 
   this.menuItem9.Index = 3;
   this.menuItem9.Text = "Paste";
   this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
   // 
   // menuItem10
   // 
   this.menuItem10.Index = 4;
   this.menuItem10.Text = "Delete";
   this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
   // 
   // menuItem11
   // 
   this.menuItem11.Index = 5;
   this.menuItem11.Text = "SelectAll";
   this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
   // 
   // menuItem8
   // 
   this.menuItem8.Index = 4;
   this.menuItem8.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                       this.menuItem12,
                       this.menuItem33});
   this.menuItem8.Text = "Help";
   // 
   // menuItem12
   // 
   this.menuItem12.Index = 0;
   this.menuItem12.Text = "About";
   this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
   // 
   // menuItem16
   // 
   this.menuItem16.Index = 3;
   this.menuItem16.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem17,
                        this.menuItem22,
                        this.menuItem23,
                        this.menuItem34});
   this.menuItem16.Text = "Insert";
   this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click);
   // 
   // menuItem17
   // 
   this.menuItem17.Index = 0;
   this.menuItem17.Text = "<HTML>...</HTML>";
   this.menuItem17.Click += new System.EventHandler(this.menuItem17_Click);
   // 
   // textBox1
   // 
   this.textBox1.BackColor = System.Drawing.SystemColors.HighlightText;
   this.textBox1.Location = new System.Drawing.Point(0, 0);
   this.textBox1.Multiline = true;
   this.textBox1.Name = "textBox1";
   this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
   this.textBox1.Size = new System.Drawing.Size(872, 520);
   this.textBox1.TabIndex = 0;
   this.textBox1.Text = "";
   this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
   // 
   // menuItem18
   // 
   this.menuItem18.Index = 2;
   this.menuItem18.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem19,
                        this.menuItem20,
                        this.menuItem21,
                        this.menuItem25});
   this.menuItem18.Text = "Format";
   // 
   // menuItem19
   // 
   this.menuItem19.Index = 0;
   this.menuItem19.Text = "Font";
   this.menuItem19.Click += new System.EventHandler(this.menuItem19_Click);
   // 
   // menuItem20
   // 
   this.menuItem20.Index = 1;
   this.menuItem20.Text = "Color";
   this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
   // 
   // menuItem21
   // 
   this.menuItem21.Index = 2;
   this.menuItem21.Text = "BackColor";
   this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
   // 
   // menuItem22
   // 
   this.menuItem22.Index = 1;
   this.menuItem22.Text = "Date";
   this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
   // 
   // menuItem23
   // 
   this.menuItem23.Index = 2;
   this.menuItem23.Text = "Time";
   this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
   // 
   // menuItem24
   // 
   this.menuItem24.Index = 0;
   this.menuItem24.Text = "New";
   this.menuItem24.Click += new System.EventHandler(this.menuItem24_Click);
   // 
   // menuItem25
   // 
   this.menuItem25.Index = 3;
   this.menuItem25.Text = "WordWrap";
   this.menuItem25.Click += new System.EventHandler(this.menuItem25_Click);
   // 
   // menuItem26
   // 
   this.menuItem26.Index = 6;
   this.menuItem26.Text = "Print";
   // 
   // menuItem27
   // 
   this.menuItem27.Index = 7;
   this.menuItem27.Text = "PageSetup";
   // 
   // menuItem28
   // 
   this.menuItem28.Index = 8;
   this.menuItem28.Text = "PrintPreview";
   // 
   // menuItem29
   // 
   this.menuItem29.Index = 6;
   this.menuItem29.Text = "Find";
   // 
   // menuItem30
   // 
   this.menuItem30.Index = 7;
   this.menuItem30.Text = "Replace";
   // 
   // menuItem31
   // 
   this.menuItem31.Index = 8;
   this.menuItem31.Text = "Goto";
   // 
   // menuItem32
   // 
   this.menuItem32.Index = 9;
   this.menuItem32.Text = "Find Next";
   // 
   // menuItem33
   // 
   this.menuItem33.Index = 1;
   this.menuItem33.Text = "Help";
   // 
   // menuItem34
   // 
   this.menuItem34.Index = 3;
   this.menuItem34.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem35});
   this.menuItem34.Text = "HTML";
   this.menuItem34.Click += new System.EventHandler(this.menuItem34_Click);
   // 
   // menuItem35
   // 
   this.menuItem35.Index = 0;
   this.menuItem35.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem36,
                        this.menuItem37,
                        this.menuItem38,
                        this.menuItem39,
                        this.menuItem44});
   this.menuItem35.Text = "<HTML>";
   this.menuItem35.Click += new System.EventHandler(this.menuItem35_Click);
   // 
   // menuItem36
   // 
   this.menuItem36.Index = 0;
   this.menuItem36.Text = "<HTML></HTML>";
   this.menuItem36.Click += new System.EventHandler(this.menuItem36_Click);
   // 
   // menuItem37
   // 
   this.menuItem37.Index = 1;
   this.menuItem37.Text = "<HTML>";
   this.menuItem37.Click += new System.EventHandler(this.menuItem37_Click);
   // 
   // menuItem38
   // 
   this.menuItem38.Index = 2;
   this.menuItem38.Text = "</HTML>";
   this.menuItem38.Click += new System.EventHandler(this.menuItem38_Click);
   // 
   // menuItem39
   // 
   this.menuItem39.Index = 3;
   this.menuItem39.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem40,
                        this.menuItem41,
                        this.menuItem42,
                        this.menuItem43});
   this.menuItem39.Text = "<HEAD></HEAD>";
   // 
   // menuItem40
   // 
   this.menuItem40.Index = 0;
   this.menuItem40.Text = "<HEAD>";
   this.menuItem40.Click += new System.EventHandler(this.menuItem40_Click);
   // 
   // menuItem41
   // 
   this.menuItem41.Index = 1;
   this.menuItem41.Text = "</HEAD>";
   this.menuItem41.Click += new System.EventHandler(this.menuItem41_Click);
   // 
   // menuItem42
   // 
   this.menuItem42.Index = 2;
   this.menuItem42.Text = "<HEAD></HEAD>";
   this.menuItem42.Click += new System.EventHandler(this.menuItem42_Click);
   // 
   // menuItem43
   // 
   this.menuItem43.Index = 3;
   this.menuItem43.Text = "<TITLE></TITLE>";
   this.menuItem43.Click += new System.EventHandler(this.menuItem43_Click);
   // 
   // menuItem44
   // 
   this.menuItem44.Index = 4;
   this.menuItem44.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem45,
                        this.menuItem47,
                        this.menuItem46});
   this.menuItem44.Text = "<BODY></BODY>";
   // 
   // menuItem45
   // 
   this.menuItem45.Index = 0;
   this.menuItem45.Text = "<BODY></BODY>";
   this.menuItem45.Click += new System.EventHandler(this.menuItem45_Click);
   // 
   // menuItem46
   // 
   this.menuItem46.Index = 2;
   this.menuItem46.Text = "</BODY>";
   this.menuItem46.Click += new System.EventHandler(this.menuItem46_Click);
   // 
   // menuItem47
   // 
   this.menuItem47.Index = 1;
   this.menuItem47.Text = "<BODY>";
   this.menuItem47.Click += new System.EventHandler(this.menuItem47_Click);
   // 
   // Form1
   // 
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.BackColor = System.Drawing.SystemColors.Window;
   this.ClientSize = new System.Drawing.Size(880, 577);
   this.Controls.Add(this.textBox1);
   this.Menu = this.mainMenu1;
   this.Name = "Form1";
   this.Text = "Form1";
   this.Load += new System.EventHandler(this.Form1_Load);
   this.ResumeLayout(false);

  }
  #endregion

  /// <summary>
  /// The main entry point for the application.
  /// </summary>
  [STAThread]
  static void Main() 
  {
   Application.Run(new Form1());
  }
bool modificat=false;
 string fis_nume="";
  private void menuItem2_Click(object sender, System.EventArgs e)
  {
   //open a file and displayIt
   OpenFileDialog fdlg = new OpenFileDialog();
   fdlg.Title = "C# Corner Open File Dialog" ;
   fdlg.InitialDirectory = @"c:\" ;
   fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" ;
   fdlg.FilterIndex = 2 ;
   fdlg.RestoreDirectory = true ;
   if(fdlg.ShowDialog() == DialogResult.OK)
   {
    
  System.IO.StreamReader objReader;
  objReader = new System.IO.StreamReader( fdlg.FileName);
  this.Text = fdlg.FileName ;
    fis_nume = fdlg.FileName;
  textBox1.Text = objReader.ReadToEnd();
  objReader.Close();

    
   }
  }
  
  private void CloseFile(){
   if (MessageBox.Show("Close File ?", "Close File", MessageBoxButtons.OKCancel) == DialogResult.OK)
   {
    this.Text = "Open a new File Please!";
    fis_nume = "";
    modificat=false;
    textBox1.Text="";
   }
   else
   {
    this.textBox1.Focus();
   }

   
   
    
   
  }

  private void Salveaza(){
   
   if (MessageBox.Show("Save ?", "Save", MessageBoxButtons.OKCancel) == DialogResult.OK)
   {
    if(fis_nume!="")
    {
     StreamWriter myStream2 = new StreamWriter(fis_nume, false);
     //false parameter is for overwrite not true = adding
     myStream2.Write(textBox1.Text);
     myStream2.Close();
    }
   }
   else
   {
      CloseFile();
   }
             
  }
  
  private void menuItem3_Click(object sender, System.EventArgs e)
  {
   if(modificat==false)
   {
    if (MessageBox.Show("Really Quit?", "Exit", MessageBoxButtons.OKCancel) == DialogResult.OK)
    {
     Application.Exit();
    }
   }
   else
   {
   
   Salveaza();
   Application.Exit();


   }
  }
  
  

  public int CurrentColumn
  {
   get { return this.textBox1.SelectionStart; }
  }

  private void ShowLLL(){
   this.Text = "OpenFile - "+ fis_nume + ".Lg." +this.textBox1.TextLength+" .Ln."+this.textBox1.Lines.Length+" .Ch."+ CurrentColumn ;
  }
  private void textBox1_TextChanged(object sender, System.EventArgs e)
  {
   modificat=true;
   ShowLLL();
  }
  
  
  private void menuItem5_Click(object sender, System.EventArgs e)
  {
   if (textBox1.SelectedText != "")
   {
    textBox1.Cut( );
   }
  }
  private void menuItem6_Click(object sender, System.EventArgs e)
  {
   if (textBox1.SelectedText != "")
   {
    if (textBox1.SelectionLength > 0)
    {
     textBox1.Copy();
    }
   }
  }

  
  private void menuItem7_Click(object sender, System.EventArgs e)
  {
   
    if (textBox1.CanUndo == true)
    {
     textBox1.Undo( );
     textBox1.ClearUndo();
    }
    
  }

  private void menuItem10_Click(object sender, System.EventArgs e)
  {
   if (textBox1.SelectedText != "")
   {
    textBox1.Cut();
   }
  }

  private void menuItem11_Click(object sender, System.EventArgs e)
  {
   textBox1.SelectAll();
  }

  private void menuItem9_Click(object sender, System.EventArgs e)
  {
   if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true)
   {
    textBox1.Paste();
    
   }
  }

  private void menuItem13_Click(object sender, System.EventArgs e)
  {
   //save file menu
   Salveaza();
  }

  private void menuItem14_Click(object sender, System.EventArgs e)
  {
   CloseFile();
   
  
  }

  private void menuItem12_Click(object sender, System.EventArgs e)
  {
  About aboutfrm = new About();
   aboutfrm.Show();
   
  }

  private void menuItem15_Click(object sender, System.EventArgs e)
  {
   
   SaveFileDialog saveFileDialog1 = new SaveFileDialog();

   saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"  ;
   saveFileDialog1.FilterIndex = 2 ;
   saveFileDialog1.RestoreDirectory = true ;

   if(saveFileDialog1.ShowDialog() == DialogResult.OK)
   {
    
     StreamWriter myStream2 = new StreamWriter(saveFileDialog1.FileName, true);
     myStream2.Write(textBox1.Text);
     myStream2.Close();
    fis_nume=saveFileDialog1.FileName;
    this.Text = fis_nume;
   }
  }

  private void menuItem17_Click(object sender, System.EventArgs e)
  {

   textBox1.AppendText("<HTML><HEAD><TITLE></TITLE><SCRIPT></SCRIPT><STYLE></STYLE></HEAD><BODY></BODY></HTML>");

  
   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void Form1_Load(object sender, System.EventArgs e)
  {
   
   this.Width = 800;
   this.Height = 600;
   textBox1.Width = this.Width-20;
   textBox1.Height = this.Height-50;

   // Set the Multiline property to true.
   textBox1.Multiline = true;
   // Add vertical scroll bars to the TextBox control.
   textBox1.ScrollBars = ScrollBars.Vertical;
   // Allow the RETURN key to be entered in the TextBox control.
   textBox1.AcceptsReturn = true;
   // Allow the TAB key to be entered in the TextBox control.
   textBox1.AcceptsTab = true;
   // Set WordWrap to True to allow text to wrap to the next line.
   textBox1.WordWrap = true;

   

  }

  
  private void menuItem19_Click(object sender, System.EventArgs e)
  {
   
    FontDialog myFontDialog = new FontDialog();
    if(myFontDialog.ShowDialog() == DialogResult.OK)
    {
     // Set the control's font.
     this.textBox1.Font = myFontDialog.Font;
    }
   
  }

  private void menuItem20_Click(object sender, System.EventArgs e)
  {
   ColorDialog myColorDialog = new ColorDialog();
   if(myColorDialog.ShowDialog() == DialogResult.OK)
   {
    // Set the control's font.
    this.textBox1.ForeColor = myColorDialog.Color;
   }
  }

  private void menuItem21_Click(object sender, System.EventArgs e)
  {
   ColorDialog myColorDialog = new ColorDialog();
   if(myColorDialog.ShowDialog() == DialogResult.OK)
   {
    // Set the control's font.
    this.textBox1.BackColor = myColorDialog.Color;
   }
  }

  private void menuItem22_Click(object sender, System.EventArgs e)
  {
   // String to DateTime
   String MyString;
   MyString = "1999-09-01 21:34 PM";
   //MyString = "1999-09-01 21:34 p.m.";  //Depends on your regional settings

   DateTime MyDateTime;
   MyDateTime = new DateTime();
   MyDateTime = DateTime.ParseExact(MyString, "yyyy-MM-dd HH:mm tt",
    null);

   this.textBox1.AppendText(MyDateTime.ToString());
  }

  private void menuItem16_Click(object sender, System.EventArgs e)
  {
  
  }

  private void menuItem23_Click(object sender, System.EventArgs e)
  {
   this.textBox1.AppendText(DateTime.Now.ToString("hh:mm:ss tt"));
   
  }

  private void menuItem24_Click(object sender, System.EventArgs e)
  {
   SaveFileDialog saveFileDialog1 = new SaveFileDialog();

   saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"  ;
   saveFileDialog1.FilterIndex = 2 ;
   saveFileDialog1.RestoreDirectory = true ;

   if(saveFileDialog1.ShowDialog() == DialogResult.OK)
   {
    
    StreamWriter myStream2 = new StreamWriter(saveFileDialog1.FileName, true);
    myStream2.Write(textBox1.Text);
    myStream2.Close();
    fis_nume=saveFileDialog1.FileName;
    this.Text = fis_nume;
    
   }
  }

  private void menuItem25_Click(object sender, System.EventArgs e)
  {
   if(this.textBox1.WordWrap==false)
   {
    this.textBox1.WordWrap=true;}
   else{
   this.textBox1.WordWrap=false;
   }
  }

  private void menuItem34_Click(object sender, System.EventArgs e)
  {
  
  }

  private void menuItem35_Click(object sender, System.EventArgs e)
  {
  
  }

  private void menuItem36_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<HTML></HTML>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem37_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<HTML>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem38_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("</HTML>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem43_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<TITLE></TITLE>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem41_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("</HEAD>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem42_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<HEAD></HEAD>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem40_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<HEAD>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem45_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<BODY></BODY");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem46_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("</BODY>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  private void menuItem47_Click(object sender, System.EventArgs e)
  {
   textBox1.AppendText("<BODY>");

   int start = textBox1.SelectionStart;
   int end = textBox1.SelectionLength;
   textBox1.Select(start,end);
  }

  
  

  

 }
}











Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…