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 Fal
{
    public partial class Form2 : Form
    {
        public Form2(string caption,string txt)
        {
            InitializeComponent();
            this.Text = caption;
            label1.Text = caption;
            text = txt;
        }
        string text = "";
        static int index = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (text == "") return;
     textBox1.Text = text.Substring(0, index)+"_";
            index++;
            if (index == text.Length + 1)
            {
                index = 0;
                timer1.Enabled = false;
            }
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            this.FormClosed += new FormClosedEventHandler(Form2_FormClosed);
            textBox1.Cursor = null;
            this.Resize += new EventHandler(Form2_Resize);
            this.Move += new EventHandler(Form2_Move);
            //+++++++++++++++++++++++++++++++++++++++++++++++++++   Setting
            textBox1.ForeColor = Fal.Properties.Settings.Default.fcolor;
            textBox1.BackColor = Fal.Properties.Settings.Default.bcolor;
            textBox1.ZoomFactor = Fal.Properties.Settings.Default.zoom;
            zoom.Value = Fal.Properties.Settings.Default.zoom;
            timer1.Interval = Fal.Properties.Settings.Default.speed;
            speed.Value  = Fal.Properties.Settings.Default.speed;
            this.Size = Fal.Properties.Settings.Default.sizee;
            Form2_Resize(null,null);
            this.Location = Fal.Properties.Settings.Default.location;
        }

        void Form2_Move(object sender, EventArgs e)
        {
            Fal.Properties.Settings.Default.location = this.Location;
        }

        void Form2_Resize(object sender, EventArgs e)
        {
            textBox1.Height=this.Height-label1.Height-50;
            textBox1.Top = label1.Top  + label1.Height + 10;
            textBox1.Width = this.Width-10;
            textBox1.Left = 2;
            Fal.Properties.Settings.Default.sizee = this.Size;
            Fal.Properties.Settings.Default.Save();
        }

        void Form2_FormClosed(object sender, FormClosedEventArgs e)
        {
            index = 0;
            timer1.Enabled = false;
            Form1 a = new Form1();
            a.Show();
         
        }

        private void speed_Scroll(object sender, ScrollEventArgs e)
        {
            timer1.Interval = speed.Value;
            Fal.Properties.Settings.Default.speed = speed.Value;
            Fal.Properties.Settings.Default.Save();
        }

        private void zoom_Scroll(object sender, ScrollEventArgs e)
        {
            textBox1.ZoomFactor = zoom.Value;
            Fal.Properties.Settings.Default.zoom = zoom.Value;
            Fal.Properties.Settings.Default.Save();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ColorDialog c = new ColorDialog();
            if (c.ShowDialog().ToString() == "OK")
            {
                textBox1.ForeColor = c.Color;
                Fal.Properties.Settings.Default.fcolor = c.Color;
                Fal.Properties.Settings.Default.Save();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ColorDialog c = new ColorDialog();
            if (c.ShowDialog().ToString() == "OK")
            {
                textBox1.BackColor  = c.Color;
                Fal.Properties.Settings.Default.bcolor = c.Color;
                Fal.Properties.Settings.Default.Save();
            }
        }

    

       
       



      
    }
}
