示例#1
0
        //
        //------------------------------------------------------------------------------------
        //

        // Loading category and building shortcuts
        private void LoadCategory()
        {
            this.Width  = 0;
            this.Height = 45;
            int x       = 0;
            int y       = 0;
            int width   = loadedCat.Width;
            int columns = 1;

            // Check if icon caches exist for the category being loaded
            // If not then rebuild the icon cache

            /*
             * if (!Directory.Exists(Path.Combine(Paths.ConfigPath, loadedCat.Name, "Icons")))
             * {
             *  ThisCategory.cacheIcons();
             * }
             */

            for (int i = 0; i < loadedCat.programShortcuts.Count; i++)
            {
                ProgramShortcut psc = loadedCat.programShortcuts[i];

                if (columns > width)  // creating new row if there are more psc than max width
                {
                    x            = 0;
                    y           += 45;
                    this.Height += 45;
                    columns      = 1;
                }

                if (this.Width < ((width * 55)))
                {
                    this.Width += (55);
                }

                // OLD
                //BuildShortcutPanel(x, y, psc);

                // Building shortcut controls
                ucShortcut pscPanel = new ucShortcut()
                {
                    Psc        = psc,
                    MotherForm = this,
                    bkgImage   = loadedCat.programImages[i]
                };
                pscPanel.Location = new System.Drawing.Point(x, y);
                this.Controls.Add(pscPanel);
                this.ControlList.Add(pscPanel);
                pscPanel.Show();
                pscPanel.BringToFront();

                // Reset values
                x += 55;
                columns++;
            }

            this.Width -= 2; // For some reason the width is 2 pixels larger than the shortcuts. Temporary fix
        }
示例#2
0
        //
        //------------------------------------------------------------------------------------
        //

        // Loading category and building shortcuts
        private void LoadCategory()
        {
            //System.Diagnostics.Debugger.Launch();

            this.Width  = 0;
            this.Height = 45;
            int x       = 0;
            int y       = 0;
            int width   = ThisCategory.Width;
            int columns = 1;

            // Check if icon caches exist for the category being loaded
            // If not then rebuild the icon cache
            if (!Directory.Exists(@MainPath.path + @"\config\" + ThisCategory.Name + @"\Icons\"))
            {
                ThisCategory.cacheIcons();
            }

            foreach (ProgramShortcut psc in ThisCategory.ShortcutList)
            {
                if (columns > width)  // creating new row if there are more psc than max width
                {
                    x            = 0;
                    y           += 45;
                    this.Height += 45;
                    columns      = 1;
                }

                if (this.Width < ((width * 55)))
                {
                    this.Width += (55);
                }

                // OLD
                //BuildShortcutPanel(x, y, psc);

                // Building shortcut controls
                ucShortcut pscPanel = new ucShortcut()
                {
                    Psc          = psc,
                    MotherForm   = this,
                    ThisCategory = ThisCategory
                };
                pscPanel.Location = new System.Drawing.Point(x, y);
                this.Controls.Add(pscPanel);
                this.ControlList.Add(pscPanel);
                pscPanel.Show();
                pscPanel.BringToFront();

                // Reset values
                x += 55;
                columns++;
            }

            this.Width -= 2; // For some reason the width is 2 pixels larger than the shortcuts. Temporary fix
        }