private void CreateControly(TypesControls type, ref object datasource)
        {
            if (myUserControl != null)
            {
                myUserControl.Dispose(); myUserControl = null;
            }
            gr = Graphics.FromHwnd(this.Handle);
            gr.DrawString(" ..يتم تحميل البيانات ", FontRight, Brushes.Red, new PointF(this.Width / 2, this.Height / 2));
            gr.Dispose();
            switch (type)
            {
            case TypesControls.Veiwstoryoption:
            {
                Createstorey(ref datasource);
                pictureBox4.Image = global::WeightsOrganizer.Properties.Resources.greenamount;
                break;
            }

            case TypesControls.All:
            {
                CreateAll(ref datasource);
                pictureBox1.Image = global::WeightsOrganizer.Properties.Resources.searchgreen;
                break;
            }

            case TypesControls.VeiwTypesoption:
            {
                CreateViewTypesy(ref datasource);
                pictureBox3.Image = global::WeightsOrganizer.Properties.Resources.greentype;
                break;
            }
            }
            if (myUserControl != null)
            {
                myUserControl.Left = 38;
                myUserControl.Size = new Size(myUserControl.Width, this.Height);
                OpenCadget(new object(), new EventArgs());
            }
        }
 public FrmDetails(int idr, string typeo)
 {
     isFrmDetails = true;
     InitializeComponent();
     _idr = idr;
     if (typeo == "أصناف")
     {
         if (!WeightsOrganizer.Controls.LogInOut.State)
         {
             txtBusinessPrice.Visible = false; lblprice.Visible = false;
         }
         xx = TypesControls.VeiwTypesoption; vewtypes();
     }
     else if (typeo == "تجار")
     {
         xx = TypesControls.Veiwcompanyoption; vewcomp();
     }
     else if (typeo == "زبائن")
     {
         xx = TypesControls.Veiwclientoption; vewclnt();
     }
 }