private void Exit1_Click(object sender, EventArgs e)   // tabmm task exit button
 {
     Object.Dispose();
     Object.Dispose();
     Object.Close();
     Object = null;
     GC.Collect();
     System.GC.Collect();
     panel8.Visible = false;
     Exit1.Visible  = false;
     Btn1.Visible   = false;
 }
        //public void DisplayImage()

        //{
        //    PictureBox imageControl = new PictureBox
        //    {
        //        Name = "Exit",
        //        Location = new Point(1170, 14),
        //        Size = new Size(18, 18)
        //    };
        //    imageControl.BringToFront();

        //    imageControl.BackColor = Color.FromArgb(41, 39, 40);
        //    imageControl.SizeMode = PictureBoxSizeMode.StretchImage;
        //    imageControl.Cursor = Cursors.Default;
        //    Controls.Add(imageControl);

        //    imageControl.Image = Image.FromFile(@"C:\Users\menas\source\repos\temple\temple\close-150192_960_720.png");
        //    imageControl.Click += new System.EventHandler(picturebox1_Click);
        //}
        //private void picturebox1_Click(object sender, EventArgs e)
        //{

        //    // this.object1.delete_Register_form(1);



        //    //  this.Controls.Remove(Reg_patient);


        //}

        //public void dynamc_button()
        //{

        //    DisplayImage();

        //    Button Reg_patient = new Button();
        //    Reg_patient = new Button
        //    {
        //        Font = new Font("Niagara Solid", 13F),
        //        Location = new Point(1078, 10),

        //        Name = "button2",
        //        Text = "تسجيل بيانات المرضي",
        //        BackColor = System.Drawing.Color.FromArgb(41, 39, 40),
        //        Cursor = Cursors.Hand,

        //        FlatStyle = FlatStyle.Standard,
        //        ForeColor = Color.WhiteSmoke,
        //        RightToLeft = RightToLeft.Yes,
        //        Size = new Size(115, 59),
        //        TabIndex = 15,
        //        UseVisualStyleBackColor = false
        //    };
        //    Reg_patient.BringToFront();
        //    Reg_patient.Click += new EventHandler(button2_Click);
        //    Controls.Add(Reg_patient);

        //    ////////////////////////////// add picture

        //}

        //private void button2_Click(object sender, EventArgs e)
        //{
        //    //object1 = new testt();             // running perfect
        //    //  this. object1.create_object_from_form(1);

        //}           /// not interested


        public void Access_btn_and_Exit(bool TrueOrFalse, int i)
        {
            if (i != 1)
            {
                this.Exit1.Visible  = TrueOrFalse;
                this.Btn1.Visible   = TrueOrFalse;
                this.panel8.Visible = TrueOrFalse;
                Object = null;
            }
            if (i == 1)
            {
                this.panel8.Visible = TrueOrFalse;
            }
            ;
        }
        private void Btn_reg_patient_Click(object sender, EventArgs e)
        {
            if (!Btn1.Visible)
            {
                Exit1.Visible = true;
                Btn1.Visible  = true;
                Object        = new Registration_patient(this, user);

                Object.Show();
            }
            else if (Btn1.Visible && !Object.Visible)
            {
                Object.Show_form_anmition();
            }
        }