Пример #1
0
        void phitem_Click(object sender, EventArgs e)
        {
            foreach (var item in pnlPhenomenas.Controls)
            {
                (item as Label).ForeColor = Color.FromArgb(255, 103, 103, 103);
                (item as Label).Font = new Font("Segoue UI", 11F, FontStyle.Regular);
            }
            (sender as Label).ForeColor = Color.FromArgb(255, 40, 179, 151);
            (sender as Label).Font = new Font("Segoue UI", 11F, FontStyle.Bold);
            pnlForHypo.Controls.Clear();
            try
            {
                for (int i = 1; i < 11; i++)
                {
                    tbHypo.Location = new Point(515, 155);
                    tbHypo.Size = new Size(429, 327);
                    PhenomenaImage pimg = new PhenomenaImage();
                    pimg.Location = new Point(0, 0);
                    pimg.btnDelete.Visible = false;
                    pimg.btnEdit.Visible = false;
                    pimg.Cursor = Cursors.Hand;
                    //counter += 155;
                    string path = "content\\phenomenas\\" + (sender as Label).Text + "-" + i + ".gif";
                    if (System.IO.File.Exists(path))
                    {
                        pimg.pbImage.ImageLocation = path;
                        pnlForHypo.Controls.Add(pimg);
                        pimg.pbImage.Paint += pbImage_Paint;
                        pimg.pbImage.Visible = true;
                        pimg.pbImage.Click += pimg_Click;
                    }
                    RedrawImages();
                }
            }
            catch (System.IO.FileNotFoundException)
            {

            }
            try
            {
                tbHypo.LoadFile(@"content/phenomenas/"+ (sender as Label).Text +".rtf", RichTextBoxStreamType.RichText);
            }
            catch (System.IO.FileNotFoundException)
            {
                tbHypo.Text = "Справочный файл удален или поврежден";
            }
        }
Пример #2
0
 private void btnImage_Click(object sender, EventArgs e)
 {
     var t = ofd.ShowDialog();
     if (t == DialogResult.OK)
     {
         PhenomenaImage pimg = new PhenomenaImage();
         pimg.pbImage.Image = Image.FromFile(ofd.FileName);
         pimg.btnDelete.Click += btnDelete_Click;
         pimg.btnEdit.Click += btnEdit_Click;
         panel2.Controls.Add(pimg);
         PhenomenaImageLocation();
     }
 }
Пример #3
0
        public FormPhenomenas()
        {
            InitializeComponent();
            if (Program.p.AdminMode)
            {
                lbUserName.Visible = false;
                label3.Visible = false;
            }
            this.FormClosing += Program.ApplicationQuit;
            this.Size = Program.currentSize;
            this.richTextBox1 = new Trestan.TRichTextBox();
            this.Location = Program.currentLocation;
            lbUserName.Text = Program.p.CurrentFullName;
            btnLogoCreativeThinker.MouseEnter += Program.LogoMouseEnter;
            btnLogoCreativeThinker.MouseLeave += Program.LogoMouseLeave;
            btnLogoEducationEra.MouseEnter += Program.LogoMouseEnter;
            btnLogoEducationEra.MouseLeave += Program.LogoMouseLeave;
            this.MouseWheel += new MouseEventHandler(tb_MouseWheel);

            DirectoryInfo dir = new DirectoryInfo(@"content\phenomenas");
            int counter = 5;
            foreach (var item in dir.GetFiles())
            {
                string tempName = item.Name;
                Label phitem = new Label();
                phitem.Location = new Point(0, counter);
                phitem.AutoSize = true;
                phitem.Cursor = Cursors.Hand;
                phitem.BackColor = Color.Transparent;
                phitem.Text = tempName.Remove(tempName.LastIndexOf(@"."));
                phitem.Size = new Size(100, 20);
                phitem.Click += phitem_Click;
                if (Program.p.currentTask._phenomenas.IndexOf(phitem.Text)>-1 && tempName.IndexOf(@".rtf")>-1)
                {
                    pnlPhenomenas.Controls.Add(phitem);
                    if (counter == 5)
                    {
                        phitem.Font = new Font("Segoue UI", 11F, FontStyle.Bold);
                        phitem.ForeColor = Color.FromArgb(255, 40, 179, 151);
                        tbHypo.LoadFile(@"content/phenomenas/" + phitem.Text + ".rtf", RichTextBoxStreamType.RichText);
                        try
                        {
                            for (int i = 1; i < 11; i++)
                            {
                                tbHypo.Location = new Point(515, 155);
                                tbHypo.Size = new Size(429, 327);
                                PhenomenaImage pimg = new PhenomenaImage();
                                pimg.Location = new Point(0, 0);
                                pimg.btnDelete.Visible = false;
                                pimg.btnEdit.Visible = false;
                                pimg.Cursor = Cursors.Hand;
                                //counter += 155;
                                string path = "content\\phenomenas\\" + phitem.Text + "-" + i + ".gif";
                                if (System.IO.File.Exists(path))
                                {
                                    pimg.pbImage.ImageLocation = path;
                                    pnlForHypo.Controls.Add(pimg);
                                    pimg.pbImage.Paint += pbImage_Paint;
                                    pimg.pbImage.Visible = true;
                                    pimg.pbImage.Click += pimg_Click;
                                }
                                RedrawImages();
                            }
                        }
                        catch (System.IO.FileNotFoundException)
                        {

                        }
                    }
                    else
                    {
                        phitem.Font = new Font("Segoue UI", 11F, FontStyle.Regular);
                        phitem.ForeColor = Color.FromArgb(255, 103, 103, 103);
                    }
                    counter += 25;
                }
            }
            if (Program.debug)
            {
                answer._hypothesises.Add("Одна из идей заключается в планомерном распределении всех параметров, что не может не являться очевидным при дальнейшем развитии событий");
                answer._hypothesises.Add("Возможно вероятность случайных событий сильно преувеличена, что влечет за собой потери смысла всех проведенных исследований");
                answer._hypothesises.Add("Не исключено, что у нас просто недостаточно данных для совершение каких либо умозаключений");
                lIdeas.Text = "Количество идей: " + answer._hypothesises.Count;
                lIdeas.Font = new Font("Segoue UI", 11F, FontStyle.Underline);
            }
        }
Пример #4
0
 void btnEdit2_Click(object sender, EventArgs e)
 {
     panel2.Controls.Clear();
     tbPhenomenaName.Text = ((sender as Button).Parent as PhenomenaItem).lblPhenomena.Text;
     tbPhenomenaContent.LoadFile(@"content/phenomenas/" + ((sender as Button).Parent as PhenomenaItem).lblPhenomena.Text + ".rtf", RichTextBoxStreamType.RichText);
     oldPhenomenaName = ((sender as Button).Parent as PhenomenaItem).lblPhenomena.Text; // записываем имя, чтобы использовать его при удалении старого файла
     for (int i = 1; i < 11; i++)
     {
         tbPhenomenaContent.Location = new Point(173, 0);
         tbPhenomenaContent.Size = new Size(430, 420);
         PhenomenaImage pimg = new PhenomenaImage();
         pimg.Location = new Point(0, 0);
         //counter += 155;
         string path = "content\\phenomenas\\" + ((sender as Button).Parent as PhenomenaItem).lblPhenomena.Text + "-" + i + ".gif";
         if (System.IO.File.Exists(path))
         {
             pimg.pbImage.ImageLocation = path;
             panel2.Controls.Add(pimg);
             pimg.btnDelete.Click+=btnDelete_Click;
             pimg.btnEdit.Click+=btnEdit_Click;
             pimg.pbImage.Paint += pbImage_Paint;
             pimg.pbImage.Visible = true;
         }
         RedrawImages();
     }
 }