Beispiel #1
0
        private void AddBooksToPanel()
        {
            pnlBooks.Controls.Clear();
            pnlBooks.AutoScroll = true;

            int height = 0;

            foreach (Book book in library.Books)
            {
                var th = new TitleHolder(library, book);
                th.Margin   = new Padding(0);
                th.Location = new Point(50, height);
                th.Name     = book.GetFileName();
                height     += th.Height;
                pnlBooks.Controls.Add(th);
            }

            foreach (Control c in pnlBooks.Controls)
            {
                if (c is TitleHolder)
                {
                    c.BringToFront();
                    return;
                }
            }
        }
Beispiel #2
0
        private void BtnRefresh_Click(object sender, EventArgs e)
        {
            library.Refresh();

            if (!IsEqualPanelLibrary())
            {
                AddBooksToPanel();
            }

            var th = new TitleHolder();

            AdjustPanel(th.Width + 50 + SystemInformation.VerticalScrollBarWidth, 3 * th.Height);
        }