예제 #1
0
        private void createBox(string name, Image img, int i)
        {
            PictureBox box;

            if (this.flowLayoutPanel1.Controls.Count > i + 1)
            {
                box = (PictureBox)this.flowLayoutPanel1.Controls[i + 1];
            }
            else
            {
                box          = new PictureBox();
                box.Size     = new Size(360, 240);
                box.SizeMode = PictureBoxSizeMode.CenterImage;
                box.Cursor   = Cursors.Hand;
                box.Tag      = name;
                box.Click   += box_Click;

                this.toolTip1.SetToolTip(box, name);
                this.flowLayoutPanel1.Controls.Add(box);
            }

            int w = box.Size.Width - box.Margin.Left - box.Margin.Right;
            int h = box.Size.Height - box.Margin.Top - box.Margin.Bottom;

            box.Image = ImageMgr.ResizeImage(img, new Size(w, h));
        }
예제 #2
0
 private void StartCategory(string name)
 {
     try
     {
         ImageMgr.InitCategory(name);
         Form1 form = new Form1();
         form.ShowDialog(this);
         Init();
     }
     catch (Exception e)
     {
         MessageBox.Show("出错啦:\n" + e);
     }
 }
예제 #3
0
        private void NextImage(bool backward = false)
        {
            try
            {
                string name;
                Image  img = backward ? ImageMgr.Prev(out name) : ImageMgr.Next(out name);

                pictureBox1.Image = img;
                label1.Text       = name;
            }
            catch (Exception e)
            {
                MessageBox.Show("出错啦:\n" + e);
            }
        }
예제 #4
0
        private void Init()
        {
            this.Bounds = Screen.PrimaryScreen.Bounds;


            try
            {
                ImageMgr.Category[] categories = ImageMgr.ListCategories();

                for (int i = 0; i < categories.Length; i++)
                {
                    ImageMgr.Category c = categories[i];
                    createBox(c.name, c.image, i);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("出错啦:\n" + e);
            }
        }