By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

user control scroll

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.