国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

C# 窗體WinForm中動態顯示radioButton實例

2019-11-17 03:07:14
字體:
來源:轉載
供稿:網友
C# 窗體WinForm中動態顯示radioButton實例

一個項目中用到的實例,根據數據庫查詢出待顯示的radioButton的個數,顯示在一個新的窗口中。

//動態顯示radioButton        public void showRadioButton(int listSize,List<String> list) {                //控件上邊緣與容器上邊緣的距離                int top = 6;                //記錄循環,控件左上角相對于容器左上角的坐標                int i = 0;                int n = 0;                RadioButton[] radioButton = new RadioButton[listSize];                for (n = 0; n < listSize; n++)                {                    if (n % 15 == 0 && n != 0)                    {                        i++;                        if (i % 5 == 0)                        {                            top = 6 * n;                            i = 0;                        }                        else                        {                            top = 6;                        }                    }                    radioButton[n] = new RadioButton();                    radioButton[n].AutoSize = true;                    radioButton[n].Top = top;                    //控件左上角相對于容器左上角的坐標,以及每個控件之間的距離                    radioButton[n].Location = new Point(i * 150 + 2, top);                    // MessageBox.Show(name[n].ToString());                    radioButton[n].Text = list[n].ToString();                    radioButton[n].Visible = true;                    radioButton[n].Name = "radioButton" + n;                    this.panel1.Controls.Add(radioButton[n]);                    top = top + 21;                }                    }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 定兴县| 宁明县| 托克逊县| 衡南县| 象州县| 将乐县| 灵山县| 东阿县| 五华县| 大埔区| 全椒县| 遵化市| 绥棱县| 巴里| 隆化县| 宜都市| 防城港市| 白山市| 克东县| 石景山区| 潼南县| 抚顺县| 什邡市| 塘沽区| 义马市| 淮南市| 个旧市| 南陵县| 内黄县| 梅河口市| 汉寿县| 鄂州市| 吉林省| 陇西县| 东光县| 庆云县| 浮梁县| 太仆寺旗| 浦县| 清原| 浑源县|