首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

关于Winform自定义控件new Point后没有显示

2013-02-25 
关于Winform自定义控件new Point后没显示本帖最后由 caozhy 于 2013-02-23 14:21:33 编辑实现RadioButtonL

关于Winform自定义控件new Point后没显示
本帖最后由 caozhy 于 2013-02-23 14:21:33 编辑 实现RadioButtonList自定义WinForm控件后调试数据都正常了,在最后

void DrawControl()
        {
            panel1.Controls.Clear();

            int count = _mappings.Length;
            //Draw and set control
            int height = 0;
            int x_aris = 50;
            int y_aris = 50;
            for (int i = 0; i < count; i++)
            {
                //create the radio button
                RadioButton radio = new RadioButton();
                radio.Name = i.ToString();
                radio.Text = _mappings[i].Text;
                radio.AutoSize = true;

                //put radio button into the panel
                panel1.Controls.Add(radio);
                radio.Location = new Point(x_aris, y_aris + height);
                height += radio.Height;

                //Add click event to radio button
                radio.Click += new EventHandler(radio_Click);
            }


        }

但是在Form端没有显示,我在Form_Load里或者按钮上都没用。 自定义WinForm控件 radiobutton
[解决办法]
在循环结束的时候看radio的位置、大小、Visible是否都正确。

热点排行