Scrolling Problems in a Form

R

Robert Gross

Hi everybody,

I have a little problem, no two. First my english is not quiet good so
please try to understand what I want and help me, please ;) And second:

I habe a Form. In this form is a ScrollableControl (modified, so it could
raise scroll events), containing another Control painting an image. Okay,
everything works fine, but if I deactivate the Form (it's a mdi child form)
and activates another Form and than go back, the scrollbars are reseted to
the default settings, very top and very left! I will get the same behavior,
when I deactivate the hole application an than activate it again. If the
mdi-child Forms are deactivate, there are showing the right scrollbar
positions and the correct clipping of the image. Only when I activate the
form, the form resets the scrollbarpositions :(

Me first solution is, receiving the activate Event raised by the form and
than set the scrollbar positions. This dosn't work! Than I try the receive
all window messages to get the WM_ACTIVATE, WM_MDIACTIVE, WM_NCACTIVATE,
WM_SETFOCUS and the WM_IME_SETCONTEXT messages. If I acted on these messages
I got a really funny behavior of me application. I have deactive (by
clicking to no application on taskbar) and than have activate (by clicking
the taskbar icon), than the scrollbar shows again the wrong position, but
when I moved the mouse of the form, the scrollbar reposition them self and
show the correct positions.

Now I react on every message posted throu the WNDPROC function and set the
scrollbar positions. This works, BUT if I do a large/small de/in-crement
scroll with one mouseclick the scrollbar do the de/increment and immediately
set them back to the previous position. This isn't good :(

Maybe some of you know the correct window message, so I can set me
scrollbars I the form will activate by clicking the nonclient or client
area, or the application and so on.

Have many, many thanks

Robert Groß
 
R

Robert Gross

Hi everybody (again),

I found me fault. The containing scrollableControl was not inherited from
ScrollableControl but from UserControl.

Now it works.

Bye
Robert.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top