示例#1
0
        public void ScrollableControl_SetAutoScrollMargin_Invoke_Success(int width, int height, Size expectedAutoScrollMargin)
        {
            var control = new ScrollableControl();

            control.SetAutoScrollMargin(width, height);
            Assert.Equal(expectedAutoScrollMargin, control.AutoScrollMargin);
        }
示例#2
0
 /// <summary>
 /// Sets the automatic scroll margin.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetAutoScrollMargin(this ScrollableControl control, Size value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetAutoScrollMargin(value)));
     }
     else
     {
         control.AutoScrollMargin = value;
         control.Refresh();
     }
 }