c# winform pictureBox如何突出显示
我按顺序4*4排了16个pictureBox,紧挨着
我现在想选中哪个pictureBox,就给哪个pictureBox突出显示,以告诉用户,你选择的是XX pictureBox
我开始想选中哪个pictureBox就给哪个边框换一种颜色,可惜不会做,然后又想稍微的把选中的pictureBox放大一圈,结果放大了也看不出效果,好象放大的部位被其它pictureBox给压住了
请问还能怎么做可以突出pictureBox,方便用户知道选择了哪个pictureBox
我的16个pictureBox都指向了同一个方法
private void pictureBox1_Click(object sender, EventArgs e){ MessageBox.Show((sender as PictureBox).Name);}
PictureBox old = null; private void pictureBox2_Click(object sender, EventArgs e) { PictureBox p = (PictureBox)sender; if (p == old) return; if (old != null) { old.Width -= 10; old.Height -= 10; old.Location = new Point(old.Location.X + 5, old.Location.Y + 5); } old = p; p.Width += 10; p.Height += 10; p.Location = new Point(p.Location.X - 5, p.Location.Y - 5); p.BringToFront(); } private void pictureBox2_Paint(object sender, PaintEventArgs e) { PictureBox p = (PictureBox)sender; if (p == old) { Pen pp = new Pen(Color.Red); e.Graphics.DrawRectangle(pp, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.X + e.ClipRectangle.Width - 1, e.ClipRectangle.Y + e.ClipRectangle.Height - 1); } }