按钮变色
borderColor边框的颜色
MouseDownBackColor鼠标悬浮在按钮上时边款的颜色
MouseOverBackColor点击时的颜色
把窗体嵌套在窗体里面
先在页面画一个panel,再添加一个页面(form)设置无边框,大小和panel一样。
上图为panel2
上图为无边框
private void OpenFrom(Form form) { form.TopLevel = false; form.TopMost = false; this.panel2.Controls.Clear(); //把panel里面的控件清空,就是显示的地方 this.panel2 .Controls.Add(form);//再把要显示的内容添加进去 form.Show(); } private void button3_Click(object sender, EventArgs e) { OpenFrom(new Form3());//把要显示的窗口传进去 }
绑定按钮,当点击按钮,panel切换页面
效果图
先添加一个panel背景红色
private void button3_Click(object sender, EventArgs e) { OpenFrom(new Form3());//把要显示的窗口传进去 ShowBar(sender as Button); } private void ShowBar(Button button) { this.panel3.Location = new Point(button.Location.X-10, button.Location.Y); }
表格ListView
传值
ListViewItem item = new ListViewItem(); item.SubItems[0].Text = person1.Id.ToString(); item.SubItems.Add(person1.Name); item.SubItems.Add(person1.Age.ToString()); listView1.Items.Add(item);
标签:控件,form,void,private,item,new,panel From: https://www.cnblogs.com/lin-07/p/17629456.html