在自定义 WPF 画布中强制排列

发布于 2024-10-11 03:02:45 字数 207 浏览 0 评论 0原文

我正在开发一个涉及创建自定义图形编辑器的项目。图形编辑器有多个选项卡,我想创建一个预览功能,该功能将显示一个弹出窗口,其中包含每个选项卡内容的位图预览。然而,我遇到的问题是,必须先安排每个选项卡的内容,然后才能为其生成正确的预览。这意味着进入每个选项卡以确保它们得到渲染和排列。然后,只有到那时,预览才能正确生成,否则预览的大小为 0x0。有谁知道如何强制安排内容控件,以便我可以生成适当大小的预览?

I'm working on a project that involves creating a custom graphical editor. The graphical editor has multiple tabs, and I want to create a preview function that will show a popup with Bitmap previews of the content of each of the tabs. However, the problem I'm running into is that the content for each of the tabs must be arranged before a proper preview can be generated for it. This means going into each of the tabs to ensure that they're rendered and arranged. Then, and only then, do the previews get properly generated, otherwise the previews have a size of 0x0. Does anybody know how to force an arrange of a content control so that I can get a properly sized preview generated ?

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

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

发布评论

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

评论(2

夏花。依旧 2024-10-18 03:02:45

显然,您可以直接调用“Arrange”方法,但是您必须小心作为参数传入的矩形,因为如果您只想强制对象绘制自身,它可能会对控件的显示产生不利影响(即可以强制其从所需位置拉出)。

Apparently you can just call the 'Arrange' method directly, but you have to be careful about the rectangle you pass in as a parameter, because it can adversely affect the display of your control if you just want to force the object to draw itself (ie can force it to draw out of the desired position).

桃扇骨 2024-10-18 03:02:45

这里是 MSDN 的链接,其中它讨论了控件的“arrangeOverride”方法。

我不确定这是否是您所需要的,但这种方法似乎正是您所要求的。

希望这有帮助!

Here is a link to MSDN where it discusses the "arrangeOverride" method of a control.

I'm not sure this is what you need, but this method seems to be what you're asking about.

Hope this helps!

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