I've a control that inherit from Scrollabe control, and does custom
painting to draw itself.
However, I can't find out how to make it display the scrollbars when I
need them. I set AutoScroll to true, but it doesn't seem to help.

Another question, when I host a text box on the control, and click on
it, and then click on the control, the focus is still on the textbox,
even though I used Seleectable style and I call Focus() and Select() on
the mouse down event.

Re: Scrollable controls questions by ayende

ayende
Sat May 21 14:17:10 CDT 2005

Found out about how to make it show the scrolling bar, but I got
another problem.
When I scroll, the image is not updated correctly, it looks like it has
been chopped.
How do I fix that?


Re: Scrollable controls questions by ayende

ayende
Sat May 21 14:27:17 CDT 2005

Okay, I managed to fix the drawing of the shapes using
TranslateTransform(), but the background is still giving me a lot of
trouble.
I want the same background no matter what the scrolling is, so I do
this:
g.FillRectangle(backgroundBrush, ClientRectangle);
g.TranslateTransform(offset.X, offset.Y );
//more painting that shows correctly

However, the background looks bad when I do that, clicking on the
control seems to fix that.
Ideas?


Re: Scrollable controls questions by dlyle

dlyle
Fri Jun 24 14:32:01 CDT 2005

Sounds like it might be a repaint issue -- try Control.Refresh()
and if that fixes things you can fine tune it to be more efficient with a
smaller
invalidation Rectangle:

Control.Invalidate(rect,bInvalidateChildren);
Control.Update();

"ayende@gmail.com" wrote:

> Okay, I managed to fix the drawing of the shapes using
> TranslateTransform(), but the background is still giving me a lot of
> trouble.
> I want the same background no matter what the scrolling is, so I do
> this:
> g.FillRectangle(backgroundBrush, ClientRectangle);
> g.TranslateTransform(offset.X, offset.Y );
> //more painting that shows correctly
>
> However, the background looks bad when I do that, clicking on the
> control seems to fix that.
> Ideas?
>
>