Silverlight 中 PictureBox 的替代品是什么?

发布于 2024-11-25 18:25:05 字数 107 浏览 4 评论 0原文

我的 Windows 窗体应用程序中有一个 PictureBox,我正在将我的应用程序转换为 Silverlight,我想知道 Silverlight 中 PictureBox 的替代品是什么,谢谢!

i have a PictureBox in my Windows Form application and i am in the process of converting my application to Silverlight and i would like to know what is the alternative of PictureBox in Silverlight, Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

避讳 2024-12-02 18:25:05

根据您使用的 PictureBox 的功能,您可以只使用 Silverlight 中的图像 控件。

Depending on the functionality of the PictureBox you are using, you could just use the Image control in Silverlight.

懷念過去 2024-12-02 18:25:05

在这种情况下,图像控件是您唯一的选择,但您应该小心,该控件仅支持 .jpg 和 .png 图像扩展名,对于其他格式,您必须创建或使用转换器

Image control is your only choice for this case, but you should be careful that this control just support .jpg and .png image extentions and for other formats you must create or use converters

恋竹姑娘 2024-12-02 18:25:05

您可能想要尝试的是 Viewbox 控件。然后,您可以在 Viewbox 内部放置图像。 Viewbox 的伟大之处在于,即使 VB 调整大小,您也始终可以一致地缩放内部的所有内容。或者,您可以使用 @Chris 指出的图像并提供尺寸限制和比例设置。

示例 XAML:

<Viewbox x:Name="vb">
    <Image x:Name="myImage" Source="pathToImage"/>
</Viewbox>

然后,您可以将 Viewbox 放置在 Stackpanel 或 Grid 中以实现正确的布局。希望这有帮助!

What you might want to try is the Viewbox control. Then, inside of the Viewbox you can place an image. The great thing about the Viewbox is that you can always scale everything inside consistently, even as the VB resizes. Or, you can use the Image as @Chris pointed out and provided size limits and a scale setting.

Sample XAML:

<Viewbox x:Name="vb">
    <Image x:Name="myImage" Source="pathToImage"/>
</Viewbox>

You could then place the Viewbox inside a Stackpanel or Grid to achieve proper layout. Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文