首页 > 代码库 > C# winform pictureBox如何突出显示,放大并给pictureBox边框变色
C# winform pictureBox如何突出显示,放大并给pictureBox边框变色
- 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);
- }
- }
C# winform pictureBox如何突出显示,放大并给pictureBox边框变色
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。