SpockMonster

I've created an application that puts several rows of controls inside a TableLayoutPanel. I set AutoScroll to true. I notice that when I scroll, it does not scroll the contents until after I let go of the scroll thumb. How can I make it scroll in "real time"

For example, a DataGridView control scrolls the contents while moving the scroll thumb up or down.

How can I make a TableLayoutPanel scroll in "real time"

Mike Spock



Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

nobugz

Try this:

private void tableLayoutPanel1_Scroll(object sender, ScrollEventArgs e) {
tableLayoutPanel1.Invalidate();
}






Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

SpockMonster

Well, I hooked up this event and did see that it is called numerous times while slowly dragging the scroll thumb. However, the control still did not reposition itself as a result of making the call:

private void tableLayoutPanel1_Scroll(object sender, ScrollEventArgs e) {

((TableLayoutPanel)sender).Invalidate().

}

I also tried calling .Refresh(), and Application.DoEvents(), but no luck.

I'll keep at this, any suggestions on getting it to re-draw during that event would be great.

Mike





Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

nobugz

I should have tried it before posting. Try this: start a new WF project, drop a TLP on the form, set AutoScroll = true, put a button in a four cells. Now edit the rows and make them absolute 200 pixels. Drag the scrollbar, it smoothly scrolls the panel both in the designer and at runtime.

How is your TLP different





Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

SpockMonster

I am proceeding now and will keep a log of actions and results as I go. Here we go....!

WF Name is TestTLP, autoscroll set true, put a button in each of 4 cells, rows made 200 pixels,

Running, testing scroll behavior, answer is: is I grab the scroll thumb and drag, the contents do not scroll until I de-click the scroll thumb. If I click on the arrows at top or bottom, it does scroll in continuous, real-time mode.

So, on my machine, it does not scroll in realtime/continuous when clicking on the thumb and dragging it vertically, but on yours it does scroll scroll in realtime by dragging the thumb Can you verify this

Mike

PS - I am using Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600). Prof. Ed. Framework is V2.0.50727. (framework 3.0 is installed on my machine). What version are you using

OMG!!! I just tried this on my personal laptop and it scrolls in realtime/continuous there!!!!! My laptop is VStudio version 8.0.50727.42 (RTM.050727-4200), the framework version is exactly the same, although I do NOT have framework version 3.0 installed. I'll have to figure out if my compiled code will work correctly when deployed to user workstations, etc. It could be something broke in the newer VStudio compiler, or it could be .Net3.0 is interferring, or something else. Do you have any thoughts on the subject

Here's some excerpts from my compiled application's Manifest - it sure looks like it is using .Net2.0, so the .Net3.0 shoudl not be interfering. I sure don't have any redirects in my GAC or anything like that:

// Metadata version: v2.0.50727

.assembly extern System.Windows.Forms

.ver 2:0:0:0

.assembly extern System.Data

.ver 2:0:0:0

.assembly extern mscorlib

.ver 2:0:0:0

.assembly extern System

.ver 2:0:0:0

Hans - thanks so much for steering me to this point! If you have any other suggestions, they'd be welcome.

Thanks again,

Mike





Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

nobugz

Control Panel + Display, Appearance tab, Effects, turn on "Show window contents when dragging".





Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

SpockMonster

OKAY - OKAY - that did it!!!! Wow, I've never stumbed into those effects settings, thanks a million.

Do you have any insight as to why DataGridView tables Do scroll in continuous/realtime mode, while TableLayoutPanels do NOT (while Effect/ShowWindowContentsWhileDragging is "off", that is) I am glad to be able to move on with my work now, but one way or the other I want to understand why these two controls scroll behavior differs, it must be they use different underlying Windows API, one which is governed by the setting and one which is not.

Hans - very good help thanks so much. I let you mark this as answered, but am giving you the chance to clear some of the mystery first so I left it open for the momemt.

Thanks Again!!!

Mike





Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

nobugz

It is an entirely different chunk of code, no reason why they should behave identically. I could research it but it seems rather a waste of my time.





Re: Windows Forms General Getting a TableLayoutPanel to Scroll in "real-time", not delayed after scroll thumb de-clicked

SpockMonster

Thanks Hans - just confirming it's a different chunk of code is fine, and I wouldn't imagine asking you to research it any further. Thanks again for resolving this.