Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ImagesForm.cs - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5a623cdf026832ef3f8383c86fcb440096f462d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace com.clusterrr.hakchi_gui
{
    public partial class ImagesForm : Form
    {
        public ImagesForm()
        {
            InitializeComponent();
            Left = Cursor.Position.X + 5;
            Top = Cursor.Position.Y + 5;
        }

        public void ShowImages(IEnumerable<Image> images)
        {
            int i = 0;
            Control[] pboxes;
            do
            {
                i++;
                pboxes = this.Controls.Find("pictureBox" + i, true);
                if (pboxes.Length > 0)
                {
                    (pboxes[0] as PictureBox).Image = null;
                    (pboxes[0] as PictureBox).Visible = false;
                }
            } while (pboxes.Length > 0);
            i = 0;
            foreach(var image in images)
            {
                i++;
                pboxes = this.Controls.Find("pictureBox"+i, true);
                if (pboxes.Length > 0)
                {
                    (pboxes[0] as PictureBox).Image = image;
                    (pboxes[0] as PictureBox).Visible = true;
                }
            }
        }

        private void ImagesForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
        }
    }
}