简体   繁体   English

C#/ WPF-Picturebox之类的控件?

[英]C#/WPF - Picturebox like control?

Does a picturebox like control exist in WPF? WPF中是否存在像控件这样的图片框? I want a control that I can easily change/retrieve the backcolor of. 我想要一个可以轻松更改/检索其背景色的控件。

Image is the class you are looking for. Image是您正在寻找的课程。 The name may be confusing, but it is a control. 名称可能会造成混淆,但这是一个控件。 Also, everything in WPF can be customized. 此外,WPF中的所有内容都可以自定义。 The background color of every control can be changed. 每个控件的背景色都可以更改。

You can use rectangle control & set the Fill property with the respective color. 您可以使用矩形控件并用相应的颜色设置Fill属性。 For click event, you can add MouseDownEvent handler to rectangle. 对于click事件,可以将MouseDownEvent处理函数添加到矩形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM