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

namespace Memo_Project.Forms
{
    public partial class frm_Register : Form
    {
        public frm_Register()
        {
            InitializeComponent();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            this.fontDialog1.ShowDialog();
            richTextBox1.SelectionFont=fontDialog1.Font;
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            this.colorDialog1.ShowDialog();
            richTextBox1.SelectionColor = colorDialog1.Color;
        }

        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            this.colorDialog1.ShowDialog();
            this.richTextBox1.SelectionBackColor = colorDialog1.Color;
        }

        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            int i = this.richTextBox1.SelectionIndent;
            i = i + 15;
            this.richTextBox1.SelectionIndent=i;
        }

        private void toolStripButton7_Click(object sender, EventArgs e)
        {
            int i = this.richTextBox1.SelectionIndent;
            i = i - 15;
            this.richTextBox1.SelectionIndent = i;
        }

        private void toolStripButton8_Click(object sender, EventArgs e)
        {
            this.richTextBox1.SelectionAlignment = HorizontalAlignment.Right;
        }

        private void toolStripButton9_Click(object sender, EventArgs e)
        {
            this.richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
        }

        private void toolStripButton10_Click(object sender, EventArgs e)
        {
            this.richTextBox1.SelectionAlignment = HorizontalAlignment.Left;
        }

        private void toolStripButton11_Click(object sender, EventArgs e)
        {
            this.richTextBox1.Redo();
        }

        private void toolStripButton12_Click(object sender, EventArgs e)
        {
            this.richTextBox1.Undo();
        }

        private void btn_New_Click(object sender, EventArgs e)
        {
            tbl_RegisterBindingSource.AddNew();
            //-----------------------------------------
            btn_Save.Enabled = true;
            btn_New.Enabled = false;
            groupBox1.Enabled = true;
            //-----------------------------------------
            txt_title.Focus();
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {
            this.tbl_RegisterBindingSource.EndEdit();
            this.tbl_RegisterTableAdapter.Update(dataSet1.tbl_Register);

            //-----------------------------------------
            MessageBox.Show("کاربر عزیز:یادداشت با موفقیت ذخیره شد", "توجه کنید.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //-----------------------------------------
            btn_Save.Enabled = false;
            btn_New.Enabled = true;
            groupBox1.Enabled = false;
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void frm_Register_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSet1.tbl_Register' table. You can move, or remove it, as needed.
            //this.tbl_RegisterTableAdapter.Fill(this.dataSet1.tbl_Register);

        }
    }
}
