开发者

Scrollable Controls and Areas in .NET with GDI+

I am having trouble understanding the proper way to create a scrollable area within a custom control using C#, .NET 3.5 and GDI+.

Is there an开发者_开发百科y documentation from Microsoft about the correct way to go about doing so? Is there a decent primer anywhere on the web?

My concerns are mainly: if I create a large graphical canvas in memory, what are the specific details about how large the canvas can (and should be)? What are the performance considerations? How much of the scrollable area should I render in advance?

For example, if I were rendering a very large graphical plot from pre-existing data, should I just render the ENTIRE plot to graphic memory and then blit it into the "scrollable" area? Or, would that exhaust available graphic related memory and start writing into the paging file?

Clarification:

For example, your web-broser isn't "redrawing" the client area everytime you scroll by re-rendering all of the elements. Static elements of the page are rendered once to a large surface, and when you move the scroll bar, the starting offset of the pre-render is simply modified.

That is the sort of behavior I'm going for. I don't want to "draw the content that would be between the start and end values for my scroll range" on paint events.


If you are talking WinForms - derive your control from ScrollableControl. Define the Client Size and just paint the appropriate portion in OnPaint.

The control handles all scrolling details for you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜