Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8542685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:07:36+00:00 2026-06-11T12:07:36+00:00

I have generated several panels on an event and in those panel i have

  • 0

I have generated several panels on an event and in those panel i have a button which will delete that particular panel. now i want to shift the other panels when i am deleting a panel that there’s no gap remain. my panel generation function is ….

public void generate_editpanel(string c)
    {
        int i, j, k, b;
        int m, n;


        //Bitmap bmp = drawled(16, 16, Color.Black, Color.White);
        //imglst.Images.Add(bmp);


        for (i = 0; i <= 20; i++)
        {
            epnl[i] = new Panel();
            epnl[i].Visible = false;
            epnl[i].Enabled = true;
            epnl[i].Name = "epnl" + c;
            epnl[i].Location = new System.Drawing.Point(x, 0);
            epnl[i].Width = 260;
            epnl[i].Height = 173;
            epnl[i].BorderStyle = BorderStyle.Fixed3D;
            EditPanel.Controls.Add(epnl[i]);


            grid[i] = new DataGridView();
            cellstl = new DataGridViewCellStyle();

            grid[i].Visible = true;
            grid[i].AllowUserToAddRows = false;
            grid[i].AllowUserToDeleteRows = false;
            grid[i].AllowUserToOrderColumns = false;
            grid[i].AllowUserToResizeRows = false;
            grid[i].AllowUserToResizeColumns = false;
            grid[i].ColumnHeadersVisible = false;
            grid[i].RowHeadersVisible = false;
            grid[i].Name = "grid" + c;
            grid[i].Location = new System.Drawing.Point(120,5);
            grid[i].Size = new System.Drawing.Size(129, 129);
            grid[i].BackgroundColor = Color.Black;
            grid[i].GridColor = Color.Green;
            grid[i].CellBorderStyle = DataGridViewCellBorderStyle.None;
            grid[i].ScrollBars = ScrollBars.None;
            fill(Color.Black, Color.White);
            for (j = 1; j <= 8; j++)
            {

                col = new DataGridViewImageColumn();
                col.Width = 16;
                col.Image = imglst.Images[0];
                col.ImageLayout = DataGridViewImageCellLayout.Normal;
                grid[i].Columns.Add(col);
                grid[i].Columns[j - 1].FillWeight = 1;
            }
            for (k = 1; k <= 8; k++)
            {
                grid[i].Rows.Add();
                grid[i].Rows[k - 1].Height = 16;
            }
            cellstl.Alignment = DataGridViewContentAlignment.MiddleCenter;
            cellstl.BackColor = Color.White;
            grid[i].CellMouseClick += new DataGridViewCellMouseEventHandler(this.gridmouseclick);
            grid[i].CellMouseMove += new DataGridViewCellMouseEventHandler(this.gridmousemove);
            grid[i].CellMouseDown += new DataGridViewCellMouseEventHandler(this.gridmousedown);
            grid[i].CellMouseUp += new DataGridViewCellMouseEventHandler(this.gridmouseup);

            //for (m = 1; m <= 8; m++)
            //{
            //    for (n = 1; n <= 8; n++)
            //    {
            //        griddata[m, n] = 0;
            //    }
            //}
            epnl[i].Controls.Add(grid[i]);




            cbtn[i] = new Button();
            cbtn[i].Visible = true;
            cbtn[i].Location = new System.Drawing.Point(1, 1);
            cbtn[i].Name = "ctbn" + c;
            cbtn[i].Width = 25;
            cbtn[i].Height = 25;
            cbtn[i].Click += new System.EventHandler(this.dropedit);
            cbtn[i].BackgroundImage = Video_Project.Properties.Resources.w2;
            cbtn[i].BackgroundImageLayout = ImageLayout.Stretch;
            epnl[i].Controls.Add(cbtn[i]);


            lbl[i] = new Label();
            lbl[i].Visible = true;
            lbl[i].Location = new System.Drawing.Point(3, 79);
            lbl[i].Name = "lblr" + c;
            lbl[i].Width = 45;
            lbl[i].Height = 13;
            lbl[i].Text = "Repeat:";
            epnl[i].Controls.Add(lbl[i]);


            lbl[i] = new Label();
            lbl[i].Visible = true;
            lbl[i].Location = new System.Drawing.Point(3, 106);
            lbl[i].Name = "lbls" + c;
            lbl[i].Width = 45;
            lbl[i].Height = 13;
            lbl[i].Text = "Speed:";
            epnl[i].Controls.Add(lbl[i]);


            lbl[i] = new Label();
            lbl[i].Visible = true;
            lbl[i].Location = new System.Drawing.Point(3, 145);
            lbl[i].Name = "lblt" + c;
            lbl[i].Width = 45;
            lbl[i].Height = 13;
            lbl[i].Text = "Text:";
            epnl[i].Controls.Add(lbl[i]);


            lbl[i] = new Label();
            lbl[i].Visible = true;
            lbl[i].Location = new System.Drawing.Point(3, 0);
            lbl[i].AutoSize = false;
            lbl[i].Width = 70;
            lbl[i].Height = 70;
            lbl[i].Text = c;
            lbl[i].TextAlign = ContentAlignment.MiddleCenter;
            epnl[i].Controls.Add(lbl[i]);
            b = Convert.ToInt32(c);
            b += 1;
            c = Convert.ToString(b);

            txt[i] = new TextBox();
            txt[i].Visible = true;
            txt[i].Location = new System.Drawing.Point(50, 72);
            txt[i].Name = "txtr" + c;
            txt[i].Width = 35;
            txt[i].Height = 20;
            txt[i].MaxLength = 2;
            epnl[i].Controls.Add(txt[i]);


            txt[i] = new TextBox();
            txt[i].Visible = true;
            txt[i].Location = new System.Drawing.Point(50, 103);
            txt[i].Name = "txts" + c;
            txt[i].Width = 35;
            txt[i].Height = 20;
            txt[i].MaxLength = 2;
            epnl[i].Controls.Add(txt[i]);


            txt[i] = new TextBox();
            txt[i].Visible = true;
            txt[i].Location = new System.Drawing.Point(50, 142);
            txt[i].Name = "txtt" + c;
            txt[i].Width = 200;
            txt[i].Height = 20;
            txt[i].MaxLength = 250;
            epnl[i].Controls.Add(txt[i]);

            x = x + 280;
        }

    } 

i am setting the visible mode of a particular panel on another event

 private void viewscreen_MouseDown(object sender, MouseEventArgs e)
    {
        int i;
        if (e.Button == MouseButtons.Right)
        {
            for (i = 0; i <= 20; i++)
            {
                //string c = Convert.ToString(b);
                //generate_editpanel(c);
                if (b == i)
                {
                    epnl[i].Visible = true;
                }
            }
        }
    }

and i am deleting a particular panel on another event …

public void dropedit(object sender, EventArgs e)
    {
        int i;
        for (i = 0; i <= 20; i++)
        {
            if (cbtn[i].Capture)
            {
                EditPanel.Controls.Remove(epnl[i]);
                epnl[i].Dispose();
            }
        }
    }

so now i am getting a gap when i am deleting a panel i want to shift the rest of the panels to left and remove that gap. any one pls help … if u need some other info pls let me know

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:07:37+00:00Added an answer on June 11, 2026 at 12:07 pm

    You can use FlowLayoutPanel as a container for panels.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that is generated based on several DataTemplate elements. One of
I have a panel with several canvases and buttons on it. I want to
We have several SQL scripts which are generated from an Entity Model. They need
I have a repeater containing several several panels. I have noticed that there is
I have several edit in Place text boxes that sit within a generated table
I have several Linq-2-sql classes generated by visual studio and now I am adding
I have a datagrid which has several static and more dynamicaly generated coloumns. The
I have a generated stub for a .net web service which has several string
We have several generated classes, these classes will be regenerated in every startup phase
I have several divs that are generated dynamically after a file is uploaded. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.