1

動的に作成された N パネルがあり、それらの間の高さは 15px です

panel.Location = new Point (x, y);  
y = panel.Bottom + 15;

幅を小さくすることができるので、パネル間の高さの距離が常に15pxである必要があります。サイズ変更のチェックが異なる方法があり、距離を変更しようとしましたが、常に異なる動作をしています...

public void checkResize(string msg_out, object panel_sender, object text_msg_sender, int panHei, int numbs)
{
    Panel pan_item = (Panel)panel_sender;
    Label lab_item = (Label)text_msg_sender;
    char[] msg_arr = msg_out.ToCharArray();
    int panWidRaz = 308 - pan_item.Width;
    int panWidw = pan_item.Width;
    if (int.Parse(pan_item.Name) != numbs - 1)
    {
        if (panWidw < buff)
        {
            /* if (panWidRaz % 15 == 0)
            {
                for (int i = int.Parse(pan_item.Name); i >= 0; i--)
                {
                    panel1.Controls[i.ToString()].Location = new Point(panel1.Controls[i.ToString()].Location.X, panel1.Controls[i.ToString()].Location.Y + 1);
                }
            }*/
        //width control becomes smaller panels are becoming more in height, it is necessary that the distance between the panels remained 15px
        }
        if (panWidw > buff)
        {
            /*if (panWidRaz % 15 == 0)
            {
                for (int i = int.Parse(pan_item.Name); i >= 0; i--)
                {
                    panel1.Controls[i.ToString()].Location = new Point(panel1.Controls[i.ToString()].Location.X, panel1.Controls[i.ToString()].Location.Y - 1);
                }
            }*/
        //width control becomes bigger panels are becoming less in height, it is necessary that the distance between the panels remained 15px
        }
        buffCountPan++;
        if (buffCountPan == panel1.Controls.Count - 1)
        {
            buff = panWidw;
            buffCountPan = 0;
        }

        if (msg_arr.Length > 26)
        {
            int panWid = (308 - pan_item.Width) / 5;
            int panWidLab = 308 - pan_item.Width;
            pan_item.Height = panHei + panWid;
            lab_item.MaximumSize = new System.Drawing.Size(300 - panWidLab, 100);
            lab_item.MinimumSize = new System.Drawing.Size(300 - panWidLab, 14);
        }
    } 
}

ここに画像を投稿することはできません...評判...私は仕事のスクリンを私のパネルにしています http://pixs.ru/showimage/Bezimeni1p_9639414_8969341.png

4

2 に答える 2