Exemplo n.º 1
0
        private void Init()
        {
            Height = PageSize * (ItemHeigth + ItemPadding.Top);

            JPanel bar;

            Control[] arr = new Control[PageSize];
            for (int i = 0; i < PageSize; i++)
            {
                bar = new JPanel
                {
                    Name       = "bar_" + i,
                    BackColor  = Color.Transparent,
                    Width      = Width,
                    Height     = ItemHeigth,
                    Left       = 0,
                    Top        = (ItemHeigth + ItemPadding.Top) * i,
                    HoverColor = HoverColor,
                    Tag        = null,
                };
                bar.Paint += new PaintEventHandler(bar_Paint);
                bar.Click += (s, e) =>
                {
                    if (ItemClick != null)
                    {
                        ItemClick(s, e);
                    }
                };
                arr[i] = bar;
            }
            Controls.Clear();
            Controls.AddRange(arr);
        }
Exemplo n.º 2
0
 private void FillData()
 {
     for (int i = 0; i < PageSize; i++)
     {
         JPanel bar = Controls.Find("bar_" + i, false)[0] as JPanel;
         var    ri  = (PageSize * (PageIndex - 1)) + i;
         if (ri < Data.Rows.Count && ri >= 0)
         {
             bar.Tag = Data.Rows[ri];
         }
         Invoke(new MethodInvoker(delegate()
         {
             bar.Refresh();
         }));
     }
 }