예제 #1
0
        private void FirstRead()
        {
            try
            {
                Label lbl = new Label();

                int w = 0;
                maxY = 0;
                int lastX = 0;
                int y     = 0;
                for (int i = curPos; i < curPos + 100; i++, w += lastX + 10)
                {
                    Image im = Image.FromFile(@"Textures\" + arrListNames[i].ToString());

                    ImagesAndNames imgNm = new ImagesAndNames(im, arrListNames[i].ToString(), i);

                    if (w + 10 + imgNm.Width > panel1.Width - 10)
                    {
                        w    = 0;
                        y   += maxY;
                        tmpX = 0;
                        maxY = 0;
                    }

                    imgNm.Location = new Point(w + 10, y + 10);

                    imgNm.pictureBox1.Click += new EventHandler(pictureBox1_Click);

                    if (i == 0)
                    {
                        pictureBox1_Click(imgNm.pictureBox1, null);
                    }

                    lastX = imgNm.MyWidth + 10;

                    tmpX += imgNm.MyWidth + 10;

                    if (maxY < imgNm.Height)
                    {
                        maxY = imgNm.Height;
                    }

                    panel1.Controls.Add(imgNm);
                }
                curPos += 100;
                panel1.AutoScrollMinSize = new Size(w + 50, y + 10);
                tmpX          = 0;
                textBox1.Text = curPos.ToString();
            }
            catch
            {
                return;
            }
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)//Search
        {
            try
            {
                bool dd = true;
                DeleteAllPictures();
                curPos = 0;
                if (textBox2.Text != "")
                {
                    int y     = 0;
                    int w     = 0;
                    int lastX = 0;
                    //int k = 0;
                    for (int i = curPos, j = 1; i < arrListNames.Count; i++)
                    {
                        string name = arrListNames[i].ToString();

                        for (int r = 0, s = textBox2.Text.Length; s < name.Length; s++, r++)
                        {
                            string nm = name.Substring(r, textBox2.Text.Length);
                            if (nm.ToLower() == textBox2.Text.ToLower())
                            {
                                Image im = Image.FromFile(@"Textures\" + arrListNames[i].ToString());

                                ImagesAndNames imgNm = new ImagesAndNames(im, arrListNames[i].ToString(), i);


                                if (w + 10 + imgNm.Width > panel1.Width - 10)
                                {
                                    w    = 0;
                                    y   += maxY;
                                    tmpX = 0;
                                    maxY = 0;
                                }


                                if (dd)
                                {
                                    pictureBox1_Click(imgNm.pictureBox1, null);
                                    dd = false;
                                }

                                imgNm.Location = new Point(w + 10, y + 10);



                                imgNm.pictureBox1.Click += new EventHandler(pictureBox1_Click);

                                if (i == 0)
                                {
                                    pictureBox1_Click(imgNm.pictureBox1, null);
                                }

                                lastX = imgNm.MyWidth + 10;

                                tmpX += imgNm.MyWidth + 10;

                                if (maxY < imgNm.Height)
                                {
                                    maxY = imgNm.Height;
                                }

                                panel1.Controls.Add(imgNm);

                                w += lastX + 10;

                                j++;
                                break;
                            }
                        }
                    }

                    panel1.AutoScrollMinSize = new Size(w + 50, y + 10);
                    tmpX = 0;
                }
            }
            catch
            {
                return;
            }
        }
예제 #3
0
        private void PrevRead()
        {
            try
            {
                bool  dd = true;
                Label l  = new Label();

                int w = 0;
                maxY = 0;
                int lastX = 0;
                int y     = 0;
                if (curPos == arrListNames.Count)
                {
                    curPos--;
                }
                if (curPos - 100 > 0)
                {
                    for (int i = curPos; i > curPos - 100; i--, w += lastX + 10)
                    {
                        Image im = Image.FromFile(@"Textures\" + arrListNames[i].ToString());

                        ImagesAndNames imgNm = new ImagesAndNames(im, arrListNames[i].ToString(), i);

                        if (w + 10 + imgNm.Width > panel1.Width - 10)
                        {
                            w    = 0;
                            y   += maxY;
                            tmpX = 0;
                            maxY = 0;
                        }

                        if (dd)
                        {
                            pictureBox1_Click(imgNm.pictureBox1, null);
                            dd = false;
                        }

                        imgNm.Location = new Point(w + 10, y + 10);

                        imgNm.pictureBox1.Click += new EventHandler(pictureBox1_Click);

                        if (i == 0)
                        {
                            pictureBox1_Click(imgNm.pictureBox1, null);
                        }

                        lastX = imgNm.MyWidth + 10;

                        tmpX += imgNm.MyWidth + 10;

                        if (maxY < imgNm.Height)
                        {
                            maxY = imgNm.Height;
                        }

                        panel1.Controls.Add(imgNm);
                    }
                    curPos -= 100;
                    panel1.AutoScrollMinSize = new Size(w + 50, y + 10);
                    tmpX = 0;
                }
                else
                {
                    for (int i = curPos; i > 0; i--, w += lastX + 10)
                    {
                        Image im = Image.FromFile(@"Textures\" + arrListNames[i].ToString());

                        ImagesAndNames imgNm = new ImagesAndNames(im, arrListNames[i].ToString(), i);

                        if (w + 10 + imgNm.Width > panel1.Width - 10)
                        {
                            w    = 0;
                            y   += maxY;
                            tmpX = 0;
                            maxY = 0;
                        }

                        if (dd)
                        {
                            pictureBox1_Click(imgNm.pictureBox1, null);
                            dd = false;
                        }

                        imgNm.Location = new Point(w + 10, y + 10);

                        imgNm.pictureBox1.Click += new EventHandler(pictureBox1_Click);

                        if (i == 0)
                        {
                            pictureBox1_Click(imgNm.pictureBox1, null);
                        }

                        lastX = imgNm.MyWidth + 10;

                        tmpX += imgNm.MyWidth + 10;

                        if (maxY < imgNm.Height)
                        {
                            maxY = imgNm.Height;
                        }

                        panel1.Controls.Add(imgNm);
                    }
                    curPos = 0;
                    panel1.AutoScrollMinSize = new Size(w + 50, y + 10);
                    tmpX = 0;
                }


                textBox1.Text = curPos.ToString();
            }
            catch
            {
                return;
            }
        }