如何在VB/WPF中绘制单个滚动多页图形 [英] How do I draw a single scrolling multipage graph in VB/WPF

查看:67
本文介绍了如何在VB/WPF中绘制单个滚动多页图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已经搜索了这个问题的答案已有一段时间了.返回到Code Project上一些非常好的,有点相关的问答之后,我想我终于可以在这里发布并交叉手指以寻求合适的答案.

在中断了10年之后,我最近又回到了一些使用VB + WPF进行业余编码的过程,该编码来自Delphi/Pascal背景.

我将使用一个非常简化的示例说明我要实现的目标.实际上,我需要的是滚动垂直图.这需要是一个一致的页面(不要像文字处理程序那样分成多个页面).可以说屏幕高度代表60分钟,但是文档本身可能会滚动几天的数据.此应用程序在此缩放图的两侧还会有一些空格,可能会让用户将文本注释输入到可移动文本框中(每个注释在单独的文本框中,分别与给定时间对齐).用户还可以单击/添加该图上的其他几个图形元素.

我的问题是,我绝对不知道该从哪里开始.我对如何正确绘制此滚动图感到困惑不解,因为它长很多页.上下移动每次都重新绘制数据元素对我来说似乎不是解决方案.我绝对坚持这一点.我可以实现各种静态的标准事物,并且仅限于我在屏幕上看到的事物.我最近在图形模块上做了漂亮的三次样条.但是同样,这些行都没有离开页面.所提供的任何帮助将不胜感激.我希望看到一些简单的代码,显示带有形状/线条/文本的长滚动页面.目前,我坚信以3D绘制场景比尝试了解这一点要容易得多.

在此先感谢您,我将随时回答您所提出的任何问题.

标记

Hi everyone,

I have searched for an answer to this question for some time. After returning to some very good, somewhat related, Q&A here on Code Project, I thought I would finally post here and cross my fingers for a suitable answer.

I am recently returning to some amateur coding using VB+WPF after a 10 year hiatus and coming from Delphi/Pascal background.

I will use a very simplified example of what I am trying to implement. What I need is essentially a scrolling vertical graph. This needs to be a consistent page(not broken into pages like a word processor). Lets say the height of the screen would represent 60 min, but the document itself may scroll for days worth of data. This application would also have some whitespace to either side of this scaled graph that may have the user input text comments into a movable text box(each comment in a separate text box, that is separately aligned with a given time).There may be a few other graphical elements along this graph as well that user can click/add.

My problem here is that I am absolutely lost on where to start with this. I am thoroughly confused by how to properly draw this scrolling graph so that it is many many pages long. redrawing the data elements with each move up or down does not seem like the solution to me. I am absolutely stuck on this. I can implement all sorts of standard things that are static and limited to what I see on the screen. I recently did a nice cubic spline on a graphic module. But again, none of those lines leave the page. ANY help that is offered will be very much appreciated. I would love to see some simple code showing a long scrolling page with shapes/lines/text. At the moment, I am convinced it would be much easier to draw a scene in 3D than to try an get this understood.

Thanks in advance and I will be watching to answer any questions asked.

Mark

推荐答案

这不是直截了当的.我不确定您真正想要的是什么,但是如果您想从一个页面到另一个页面,我建议使用带有窗格的滚动条,并用正确的页面替换窗口中的图像.如果您只想滚动,则可以将页面放入网格中,然后将网格放入滚动面板中.
This is not straignt forward. I am not sure what you really want, but if you want to page from one to the other I would suggest using a scroll bar with a pane and replacing the image in the window with the correct page. If you are willing to just scroll, I would put the pages into a grid, and put the grid in a scroll panel.


感谢您的回复,对于我自己的延迟,我们深表歉意. br/>
我将尝试您的建议,看看有什么结果.我看这不是那么简单.

为了澄清起见,网页是一个更好的例子.平滑滚动单个文档.但长度会明显不同.例如,如果网页的顶部到底部可能代表60分钟的时间/绘制的数据,则可能滚动了很多小时甚至几天的数据.(这也可能是从左到右的.此处的限制).

也许我会坚持让它看起来像使用滚动面板滚动一样,重新绘制放置在其上的所有元素/数据.对于时间/数据曲线来说,这似乎很简单,但是我不知道如何移动另一个元素,例如文本框.

我想我记得读过xcode和/或QT在较大画布上有视口的地方.尽管我从未在这两种环境中工作过,但表面上看起来像是一种解决方案.

任何其他建议都值得欢迎.

也许我需要更多地了解问题的胆量",而不是认为有一些组件可以解决问题.谁能提供一个简短的解释,说明网页在滚动时如何缓冲/绘制网页?还是该死,记事本怎么样?

我的头很痛.
Thanks for the Reply, and apologies for my own delay.

I will give your suggestion a try and see what results. I can see this is not so straight forward.

For clarification, a web page is a better example. Smooth scrolling single document. but can significantly vary in length. ie if the top to bottom of a webpage may represent 60 min of time/data plotted, there may be many hours or even days of data one could scroll through.(this could also be left to right scolling. The direction doesnt seem to be the limitation here).

Perhaps I will be stuck with making it appear to scroll with a scroll panel, redrawing any elements/data I place on it. That seems simple for just a time/data curve, but I have no idea how to move another element like a text box.

I think I remember reading where xcode and/or QT had a viewport to a larger canvas. Though I have never worked in either environment to know, that seems, on the surface, like a solution.

Any other advice is more than welcome.

Perhaps I need to get more into the "guts" of the issue as opposed to thinking there is some component to solve the problem. Can anyone provide a brief explanation of HOW a webpage buffers/draws the page as it scrolls? Or hell, how about just notepad.

My head hurts.


这篇关于如何在VB/WPF中绘制单个滚动多页图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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