cmm cmm - 1 year ago 156
C# Question

Prevent FlowLayoutPanel scrolling to updated Control

I have an application which uses a FlowLayoutPanel with a lot of Custom UserControls in it. The Custom UserControls contains a Label.

The problem:
When the Label is updated the FlowLayoutPanel automatically scrolls it into view (Similar to the FlowLayoutPanel.ScrollControlIntoView() function).

This is the code snippet that makes the FlowLayoutPanel Scroll:

private void DownloadChanged(Object sender, DownloadProgressChangedEventArgs e)
progressDownload.Value = e.ProgressPercentage;
lblDownloaded.Text = e.BytesReceived.ToString() + " / " + e.TotalBytesToReceive.ToString();

I have been trying to find an event in the FlowLayoutPanel which I can intercept and stop it from scrolling when a child updates but I have not had any luck so far.

Is it possible to do this? If yes, how would I go about it? Thanks!

cmm cmm
Answer Source

Setting the the Label's AutoSize Property to False seems to do the trick.

Read more here: Similar Issue

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download