滚动查看器和画布的问题

发布于 2024-09-25 02:05:04 字数 341 浏览 0 评论 0原文

我有一个自定义的 canvas 控件,它位于 scrollviewer 内 - 我已经实现了 canvas 上的项目的拖放和移动,并覆盖了 >MeasureOverride 这样,当我在画布上移动项目时,其大小会反映更改,因此,如果我将项目移动到画布的可见部分之外,它将调整大小以适应移动的项目,并且滚动条将适当显示。

但是,如果我随后使用滚动条将项目放入视图中,然后开始再次将项目移回视图中,滚动条就会变得有点失控。

我担心这对问题的解释相当糟糕,但我不知道还能怎么说,但希望它能包含足够的信息,让有人为我指明正确的方向。

I have a custom canvas control which sits inside a scrollviewer - I have implemented drag, drop and move for items on the canvas and overridden MeasureOverride so that when I move an item around on the canvas its size reflects the changes so if I move the item beyond the visible portion of the canvas it will resize to accommodate the moved item and scrollbars will show appropriately.

However if I then bring the item into view by using the scrollbars then start to move the item back out again the scrollbars go a bit haywire.

It's a rather poor explanation of the problem I afraid but I am not sure how else to put it but hopefully it will contain enough info for somebody to point me in the right direction.

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

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

发布评论

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

评论(1

缱倦旧时光 2024-10-02 02:05:04

是的,你是对的,需要对问题进行更多解释。尽管我也遇到了 Canvasscroll-viewer 的很多问题,但请查看这个问题以了解我遇到的问题以及我如何解决该问题 -

< a href="https://stackoverflow.com/questions/3061400/scrollbars-are-not-visible-after-change-positions-of-controls-inside-a-canvas">更改控件位置后滚动条不可见在画布内

我必须使用base.InvalidateMeasure()
每次操作后明确
刷新画布并使
滚动条可见。

Yes you are right, more explanation of problem is required. Although I was also in a situation where I faced a lot of issues with Canvas and scroll-viewer, look at this question for problems I faced and how I solved that -

ScrollBars are not visible after changing positions of controls inside a Canvas

I had to use base.InvalidateMeasure()
explicitly after each operation to
refresh the canvas and make the
scrollbars visible.

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