zoukankan      html  css  js  c++  java
  • 请教:TableLayoutPanel.Controls.Add中的下一个可行的单元位置(.net2.0,C#)

    由于在新手区没有观众给意见,希望到精华区能找到帮助。谢谢。

    运行环境:.net 2.0

    AddAButtonIntoTable:

      private void button1_Click(object sender, EventArgs e)
            {
                Button b = new Button();
                b.Text = "new button" + (++index).ToString();
                tableLayoutPanel1.Controls.Add(b, (int)nColumn.Value, (int)nRow.Value);
            }
            int index = 0;

    测试项目文件:/Files/zzj8704/TableLayoutTest.zip

    初始状态:

    问题:单击6次,出现如下结果,那位请解释为何结果如下.谢谢。

    参考:

    TableLayoutPanel1.Controls.Add(aButton,3,3);

    Columns in a TableLayoutPanel are numbers starting at 1, while rows start at 0. Thus the
    example shown above adds aButton to the cell in column 3 at row 3, which is actually the
    fourth column and the fourth row the user sees. Note, however, that if a cell is already
    occupied by a control, your control might not be added to that cell. Controls added to cells
    at design time generally have precedence over controls added at run time. In these cases the
    control is simply added to the next available cell. If you add the control to a cell that contains
    another control that has been added at run time, the cell already in that position will usually
    be moved down to the next available cell in favor of the control just added. As always, careful
    testing is important.

  • 相关阅读:
    mysql启动失败一例
    Windows 10 执行pip list报错 UnicodeDecodeError: 'gbk' codec can't decode
    GPT转MBR
    python_查找模块的方法
    python_函数中使用*和**
    Python_单元测试工具nose
    状态迁移法
    场景分析法
    可爱的Python_课后习题_CDay0 时刻准备着!发布
    可爱的Python_课后习题_CDay−2 完成核心功能
  • 原文地址:https://www.cnblogs.com/zzj8704/p/1503103.html
Copyright © 2011-2022 走看看