首页 新闻 会员 周边 捐助

TableLayoutPanel 内控件布局的问题

0
悬赏园豆:5 [已关闭问题] 关闭于 2019-02-25 16:32

代码:

        private void button1_Click(object sender, EventArgs e)
        {
            tableLayoutPanel2.CellBorderStyle = TableLayoutPanelCellBorderStyle.None;
            Button b1 = new Button() { Dock = DockStyle.Fill, BackColor = Color.Pink,FlatStyle=FlatStyle.Flat };
            Button b2 = new Button() { Dock = DockStyle.Fill, BackColor = Color.Orange, FlatStyle = FlatStyle.Flat };
            Button b3 = new Button() { Dock = DockStyle.Fill, BackColor = Color.Red, FlatStyle = FlatStyle.Flat };
            Button b4 = new Button() { Dock = DockStyle.Fill, BackColor = Color.Green, FlatStyle = FlatStyle.Flat };
            b1.FlatAppearance.BorderSize = 0;
            b2.FlatAppearance.BorderSize = 0;
            b3.FlatAppearance.BorderSize = 0;
            b4.FlatAppearance.BorderSize = 0;
            tableLayoutPanel2.Controls.Add(b1, 0, 0);
            tableLayoutPanel2.Controls.Add(b2, 0, 1);
            tableLayoutPanel2.Controls.Add(b3, 0, 2);
            tableLayoutPanel2.Controls.Add(b4, 0, 3);
        }

 

效果:

我想要的是色块之间不要有间隙,该怎么做?

左眼水星的主页 左眼水星 | 初学一级 | 园豆:123
提问于:2018-01-26 14:45
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册