private void Row_OnClick(object sender, EventArgs e)
        {
            ListRow Row         = (ListRow)sender;
            int     Offset      = CalcOffset(Row);
            int     ScrollIndex = CalcScrollIndex();

            if ((ScrollIndex + Offset) >= pListItems.Count)
            {
                return;
            }

            Row.BackColor  = RowSelectedColor;
            pSelectedIndex = ScrollIndex + Offset;

            UpdateLayout();

            if (SelectedIndexChanged != null)
            {
                SelectedIndexChanged(this, EventArgs.Empty);
            }

            if (OnRowClick != null)
            {
                OnRowClick(this, EventArgs.Empty);
            }
        }
        protected virtual int CalcOffset(ListRow Row)
        {
            int Offset = (Row.Top + Row.Height) / ListRow.CONTROL_HEIGHT;

            if (ListScroller.Value == 0)
            {
                return(Offset - 1);
            }
            else
            {
                return(Offset);
            }
        }
        protected virtual void UpdateLayout()
        {
            if (!bLayoutUpdating)
            {
                bLayoutUpdating = true;

                MaxVisibleRows = (this.Height / ListRow.CONTROL_HEIGHT) + 2;

                if (ListRows.Count < MaxVisibleRows)
                {
                    ListRow NewRow;

                    //for (int i = 0; i < MaxVisibleRows - ListRows.Count; i ++)
                    for (int i = 0; i < MaxVisibleRows; i++)
                    {
                        NewRow = new ListRow();
                        NewRow.CmdKeyPressed += new CmdKeyPressedHandler(Row_ArrowPressed);
                        NewRow.OnClick       += new EventHandler(Row_OnClick);
                        NewRow.OnDoubleClick += new EventHandler(Row_OnDoubleClick);
                        NewRow.Width          = this.Width;
                        NewRow.Left           = 0;
                        NewRow.BackColor      = Color.White;
                        ElementsPanel.Controls.Add(NewRow);
                        ListRows.EnqueueBack(NewRow);
                    }
                }

                int ScrollIndex = (int)Math.Floor((double)ListScroller.Value / (double)ListRow.CONTROL_HEIGHT);

                for (int i = 0; i < ListRows.Count; i++)
                {
                    if ((ScrollIndex + i) >= pListItems.Count)
                    {
                        ListRows[i].ListInfo = null;
                    }
                    else
                    {
                        ListRows[i].ListInfo = pListItems[ScrollIndex + i];
                    }

                    ListRows[i].Top       = (i * ListRow.CONTROL_HEIGHT) - (ListScroller.Value % ListRow.CONTROL_HEIGHT);
                    ListRows[i].BackColor = GetRowColor(ScrollIndex + i);
                    ListRows[i].Font      = pFont;
                    ListRows[i].Visible   = true;
                    ListRows[i].Width     = ElementsPanel.Width;
                }

                bLayoutUpdating = false;
            }
        }