471,355 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,355 software developers and data experts.

user control scroll

Hi,

I am writing a hex edit control from a UserControl. I use drawtext
method of the graphics object in the OnPaint. When the text which I
draw go out of the visible rectangle of the control I want to create
scrollbars but they don't appear - I set autoscroll to true and
autoscrollmargin to (5,5).
If I add a button or other controls the scrollbars are working.

What can I do and what is my mistake?

Thanks.

Dec 2 '05 #1
1 6004
edi,

Yes, this is the way how the build-in scrolling works in windows forms. The
control is a container and it scrolls its content (the controls it contains)
e.g. If a child control doesn't fit the scrolling area it shows up scroll
bars, so one can scroll to see all the controls.

The idea of implementing scrolling in windows forms is to add a child
control (e.g. panel ) to the scrollable control and use this panel as a
drawing canvas. When you need more space just resize the panel and the
container will adjust the scroll bars accordingly.

If you want to implement the type of scrolling you are after you need to use
scrollbar controls and implement your own logic of invalidation and redraw.

I also sometime miss the old Win32 scolling API.
HTH
Stoitcho Goutsev (100) [C# MVP]

"edi sol" <es********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,

I am writing a hex edit control from a UserControl. I use drawtext
method of the graphics object in the OnPaint. When the text which I
draw go out of the visible rectangle of the control I want to create
scrollbars but they don't appear - I set autoscroll to true and
autoscrollmargin to (5,5).
If I add a button or other controls the scrollbars are working.

What can I do and what is my mistake?

Thanks.

Dec 2 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Arlie Rahn | last post: by
6 posts views Thread by martin | last post: by
reply views Thread by WhiteWizard | last post: by
3 posts views Thread by =?Utf-8?B?Qw==?= | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.