title: Programmatically Scrolling is not working C# WinForm
body: <p>i have one panel and i put a flow layout panel in the main panel and flow layout panel has many images. my UI looks like this
  <img src="https://i.stack.imgur.com/14eJG.png" alt="enter image description here"></p>
  
  <p>now i got a code which scroll the container in the panel. i mean the flow layout will scroll in main panel when i will place my mouse at the left or right most area on the main panel. their code is working i checked but when i place their code in my project then that is not working, i means scrolling is not working when i place my mouse at the left or right most area on the main panel.</p>
  
  <p>here i am attaching main code which causes to scroll the flow layout panel inside in main panel</p>
  
  <pre><code>protected override CreateParams CreateParams
          {
              get
              {
                  CreateParams cp = base.CreateParams;
                  cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
                  return cp;
              }
          } 
           int _myval = 5;
          protected override void OnMouseMove(MouseEventArgs e)
          {
              base.OnMouseMove(e);
  
              if (e.Y &lt; metroPanel1.Top || e.Y &gt; metroPanel1.Top + metroPanel1.Height) return;
  
              if (e.X &lt;= metroPanel1.Left &amp;&amp; e.X &gt;= metroPanel1.Left - 40)
              {
                  if (metroPanel1.HorizontalScroll.Value &lt;= _myval)
                  {
                      metroPanel1.HorizontalScroll.Value = _myval;
                  }
                  else
                  {
                      metroPanel1.HorizontalScroll.Value -= _myval;
                  }
              }
  
              if (e.X &lt;= (metroPanel1.Left + metroPanel1.Width + 40)   &amp;&amp; e.X &gt;= (metroPanel1.Left + metroPanel1.Width))
              {
                  metroPanel1.HorizontalScroll.Value += _myval;
              }
          }
  </code></pre>
  
  <p>i just do not understand this value 40 used here <code>if (e.X &lt;= metroPanel1.Left &amp;&amp; e.X &gt;= metroPanel1.Left - 40)</code></p>
  
  <p>i guess i need to use different value rather than 40 but i used 10 &amp; 20 but did not work.
  here is my full project link from where anyone can download and see what is wrong in my routine which prevent the scrolling. here is the link <strong><a href="https://onedrive.live.com/embed?cid=C4A6F16F34D7540A&amp;resid=C4A6F16F34D7540A%21134&amp;authkey=AM5Fq2gcFLtcw_A" rel="nofollow noreferrer">https://onedrive.live.com/embed?cid=C4A6F16F34D7540A&amp;resid=C4A6F16F34D7540A%21134&amp;authkey=AM5Fq2gcFLtcw_A</a></strong></p>
  
  <p>so it is my request that please some one see my code and guide me what i need to change in code and why. thanks</p>