Example #1
0
 private void Vs_ValueChanged(object sender, EventArgs e)
 {
     XOffest = ((HScrollBar)sender).Value - ((HScrollBar)sender).Minimum;
     if (!m)
     {
         m = true;
         t.Start();
         XOffestChanged?.Invoke(this, EventArgs.Empty);
     }
 }
Example #2
0
 public bool Vsitem(bool b = false)
 {
     if (moveItem != null)
     {
         return(false);
     }
     if (b && parent.ishs)
     {
         HScrollBar vs = (HScrollBar)(parent.Controls["HScrollBarBase"]);
         if (parent.Width != 0)
         {
             if (parent.isvs)
             {
                 vs.Width = parent.Width - 16;
             }
             else
             {
                 vs.Width = parent.Width;
             }
         }
         else
         {
             vs.Width = Width;
         }
     }
     if (!vsed)
     {
         int thisWidth = 0;
         for (int i = 0; i < sortedItems.Count; i++)
         {
             sortedItems[i].X = thisWidth;
             thisWidth       += sortedItems[i].Width;
         }
         vsed = true;
         if (thisWidth == 0)
         {
             return(false);
         }
         if (parent != null)
         {
             HScrollBar vs = (HScrollBar)(parent.Controls["HScrollBarBase"]);
             if (thisWidth > Width)
             {
                 parent.ishs = true;
                 if (!vs.Visible)
                 {
                     vs.Show();
                 }
                 if (vs.Width == 0)
                 {
                     vs.Width = Width;
                 }
                 vs.Maximum     = thisWidth;
                 vs.LargeChange = parent.Width;
                 vs.SmallChange = 5;
                 int targetVal = vs.Value - vs.Minimum;
                 if (xOffiest != targetVal)
                 {
                     xOffiest = targetVal;
                     XOffestChanged?.Invoke(this, null);
                 }
             }
             else
             {
                 parent.ishs = false;
                 if (vs.Visible)
                 {
                     vs.Hide();
                 }
                 if (xOffiest != 0)
                 {
                     xOffiest = 0;
                     XOffestChanged?.Invoke(this, null);
                 }
             }
             allWidth = thisWidth;
             return(true);
         }
         allWidth = thisWidth;
         return(true);
     }
     return(false);
 }