如何改变一个PictureBox(WinForm的)的边框颜色? [英] How to change the border color of a picturebox (winform)?

查看:2711
本文介绍了如何改变一个PictureBox(WinForm的)的边框颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想周围设置在PictureBox的边框的颜色/风格和关闭根据不同的事件。

I want to set the border color/style around the picturebox on and off according to different events.

是否有属性或帮助我实现这一目标的功能?

Are there properties or functions that help me to achieve that aim?

推荐答案

的WinForms不会让你改变控件的边框颜色,它们是由用户选择的既定主题。得到你想要的,不需要编写您自己控制什么最简单的方法就是把图片框一个小组内,使它略小。然后,只需改变面板的背景色。

Winforms doesn't let you change the border color of controls, they are fixed by the theme selected by the user. The easiest way to get what you want that doesn't require writing your own control is to put the picture box inside of a Panel, making it slightly smaller. Then just change the BackColor of the panel.

设计者会打你一点,因为它试图对齐控件到网格,编辑在属性的位置和大小的属性窗口直接而不是鼠标移动它。

The designer will fight you a bit since it tries to align controls to a grid, edit the Location and Size properties in the Properties window directly rather than mousing it.

这篇关于如何改变一个PictureBox(WinForm的)的边框颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆