public void alterRowAndColumnCount()
        {
            ColumnStyles.Clear();
            RowStyles.Clear();
            var count = Controls.Count;

            if (count != 0)
            {
                ColumnCount = (int)Math.Floor(Math.Log(count, 2)) + 1;
                RowCount    = (int)Math.Ceiling((double)count / ColumnCount);
                for (int i = 1; i <= this.RowCount; i++)
                {
                    //RowStyles.Add(new RowStyle(SizeType.AutoSize, StudentCell.MINIMUM_SIZE.Height));
                    RowStyles.Add(new RowStyle()
                    {
                        Height = 100 / RowCount, SizeType = SizeType.Percent
                    });
                }
                for (int i = 1; i <= this.ColumnCount; i++)
                {
                    //ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, Width / ColumnCount));
                    ColumnStyles.Add(new ColumnStyle()
                    {
                        Width = 100 / ColumnCount, SizeType = SizeType.Percent
                    });
                }
            }
        }
 public CustomTableLayoutPanel()
 {
     RowStyles.Clear();
     RowStyles.Add(new RowStyle(SizeType.Percent, 0.25F));
     RowStyles.Add(new RowStyle(SizeType.Percent, 0.75F));
     BackColor = Color.Beige;
 }
Exemplo n.º 3
0
        public void PopulateTable()
        {
            RowStyles.Clear();
            Controls.Clear();
            if (LocalReferencedArticles.Count + SitecoreReferencedArticles.Count > 0)
            {
                Label ReferencedArticlesHeader = CreateHeaderLabel(@"Referenced Articles: ");
                SetColumnSpan(ReferencedArticlesHeader, ColumnCount);
                RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
                Controls.Add(ReferencedArticlesHeader);
                ConfigureLabel(ReferencedArticlesHeader);
                foreach (ArticlePreviewInfo article in LocalReferencedArticles)
                {
                    bool bold = !SitecoreReferencedArticles.Select(a => a.ArticleNumber).Contains(article.ArticleNumber);
                    AddRow(article, false, bold, false);
                }
                foreach (ArticlePreviewInfo article in SitecoreReferencedArticles.Where(a => !LocalReferencedArticles.Select(b => b.ArticleNumber).Contains(a.ArticleNumber)))
                {
                    bool italic = !LocalReferencedArticles.Select(a => a.ArticleNumber).Contains(article.ArticleNumber);
                    AddRow(article, italic, false, false);
                }
            }

            if (LocalRelatedArticles.Count + SitecoreRelatedArticles.Count > 0)
            {
                Label RelatedArticlesHeader = CreateHeaderLabel(@"Related Articles: ");
                SetColumnSpan(RelatedArticlesHeader, ColumnCount);
                RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
                Controls.Add(RelatedArticlesHeader);
            }
            foreach (ArticlePreviewInfo article in SitecoreRelatedArticles)
            {
                if (LocalReferencedArticles.Select(a => a.ArticleNumber).Contains(article.ArticleNumber))
                {                 //sitecore related article already referenced inline locally, so strikeout
                    AddRow(article, true, false, false);
                }
                else
                {
                    AddRow(article);
                }
            }
            foreach (ArticlePreviewInfo article in LocalRelatedArticles)
            {
                if (!HasArticle(SitecoreRelatedArticles, article))
                {
                    AddRow(article, false, true);
                }
            }
            if (IsDifferentFromSitecore())
            {
                MenuItem.HasChanged = true;
                MenuItem.UpdateBackground();
                MenuItem.Refresh();
            }
            UpdateMenuItem();
        }
Exemplo n.º 4
0
 private void addProperty(Property p)
 {
     RowCount++;
     RowStyles.Clear();
     for (int i = 0; i < RowCount; i++)
     {
         RowStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0f / RowCount));
     }
     Controls.Add(p, 0, RowCount - 1);
 }
Exemplo n.º 5
0
 public void clearProperties()
 {
     SuspendLayout();
     Controls.Clear();
     ColumnCount = 1;
     RowCount    = 0;
     ColumnStyles.Clear();
     ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     RowStyles.Clear();
     RowStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     ResumeLayout();
 }
 void nomalizeRowStyles()
 {   // set all rows to absolute and the last one to percent=100!
     if (rowHeights.Length <= 0) return;
     rowHeights = GetRowHeights();
     RowStyles.Clear();
     for (int i = 0; i < RowCount - 1; i++)
     {
         RowStyle cs = new RowStyle(SizeType.Absolute, rowHeights[i]);
         RowStyles.Add(cs);
     }
     RowStyles.Add ( new RowStyle(SizeType.Percent, 100) );
     isNormal = true;
 }
Exemplo n.º 7
0
        private void BuildBoxes(MultiText multiText)
        {
            SuspendLayout();

            if (Controls.Count > 0)
            {
                _inputBoxes.Clear();
                Controls.Clear();
                RowCount = 0;
                RowStyles.Clear();
            }
            Debug.Assert(RowCount == 0);
            foreach (IWritingSystemDefinition writingSystem in WritingSystemsForThisField)
            {
                RowStyles.Add(new RowStyle(SizeType.AutoSize));


                var box = AddTextBox(writingSystem, multiText);
                if (box == null)
                {
                    continue;
                }

                Label label = AddWritingSystemLabel(((IControlThatKnowsWritingSystem)box).WritingSystem.Abbreviation);
                label.Click      += subControl_Click;
                label.MouseWheel += subControl_MouseWheel;

                Controls.Add(label, 0, RowCount);
                Controls.Add(box, 1, RowCount);

                if (_showAnnotationWidget)                 //false for ghosts
                {
                    //TODO: THIS IS TRANSITIONAL CODE... AnnotationWidget should probably become a full control (or go away)
                    AnnotationWidget aw = new AnnotationWidget(multiText,
                                                               writingSystem.Id,
                                                               box.Name + "-annotationWidget");
                    Control annotationControl = aw.MakeControl(new Size());                     //p.Size);
                    annotationControl.Click += subControl_Click;
                    annotationControl.Anchor = AnchorStyles.Right;
                    Controls.Add(annotationControl, 2, RowCount);
                }
                //else
                //{
                //    SetColumnSpan(box, 2);
                //}
                RowCount++;
            }

            ResumeLayout(false);
        }
        public void UpdateRows()
        {
            Controls.Clear();
            RowStyles.Clear();

            RowCount = Documents.Count;
            InitScrollBar();

            for (int i = 0; i < Documents.Count; i++)
            {
                Controls.Add(Documents[i], 0, i);                   //add control to view
                RowStyles.Add(new RowStyle(SizeType.Absolute, 95)); //style the just added row
            }
        }
Exemplo n.º 9
0
 private void ResetLayout()
 {
     RowCount    = _configuration.Rows;
     ColumnCount = _configuration.Columns;
     ColumnStyles.Clear();
     RowStyles.Clear();
     for (var i = 0; i < ColumnCount; i++)
     {
         ColumnStyles.Add(new ColumnStyle(SizeType.Percent, (int)(100m / ColumnCount)));
     }
     for (var i = 0; i < RowCount; i++)
     {
         RowStyles.Add(new RowStyle(SizeType.Percent, (int)(100m / RowCount)));
     }
     ResetViews();
 }
Exemplo n.º 10
0
        public void UpdateRows()
        {
            Controls.Clear();
            RowStyles.Clear();

            RowCount = Alternatives.Count;
            InitScrollBar();

            //update alternative identifier strings

            for (int i = 0; i < Alternatives.Count; i++)
            {
                Alternatives[i].Alternative.GenerateIdentifier(i);
                Controls.Add(Alternatives[i], 0, i);                //add control to view

                RowStyles.Add(new RowStyle(SizeType.Absolute, 95)); //style the just added row
            }
        }
Exemplo n.º 11
0
        public void Clear()
        {
            //Debug.WriteLine("VBox " + Name + "   Clearing");

            RowCount = 0;
            RowStyles.Clear();
            while (Controls.Count > 0)
            {
                DetailList list = Controls[0] as DetailList;
                if (list != null)
                {
                    list.LabelsChanged -= OnLabelsChanged;
                    list.Clear();
                }
                Controls[0].Dispose();
            }
            Controls.Clear();
            // Debug.WriteLine("VBox " + Name + "   Clearing DONE");
        }
Exemplo n.º 12
0
        /// <summary>
        /// Initialize the visible field
        /// </summary>
        /// <param name="rows">
        /// Number of rows the game will have
        /// </param>
        /// <param name="cols">
        /// Number of columns the game will have
        /// </param>
        private void InitializeField(int rows, int cols)
        {
            RowStyles.Clear();
            ColumnStyles.Clear();

            RowCount    = rows + 1;
            ColumnCount = cols;

            for (int i = 0; i <= rows; i++)
            {
                RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            }
            for (int i = 0; i < cols; i++)
            {
                ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
                Marker marker = new Marker(i);
                marker.MouseClick += Marker_Clicked;
                Controls.Add(marker, i, 0);
            }
        }
        private void NomalizeRowStyles()
        {
            // set all rows to absolute and the last one to percent=100!
            if (_rowHeights.Length <= 0)
            {
                return;
            }
            _rowHeights = GetRowHeights();
            RowStyles.Clear();
            for (var i = 0; i < RowCount - 1; i++)
            {
                var rowStyle = new RowStyle(SizeType.AutoSize);
                if (i < _rowHeights.Length)
                {
                    rowStyle = new RowStyle(SizeType.Absolute, _rowHeights[i]);
                }
                RowStyles.Add(rowStyle);
            }
            RowStyles.Add(new RowStyle(SizeType.Percent, 100));

            _isNormal = true;
        }
Exemplo n.º 14
0
        public void UpdateShownObjectives()
        {
            Controls.Clear();
            RowStyles.Clear();
            IEnumerable <ObjectiveViewPanel> toAdd = Sort(_objectives.Where(GetPriorityMethod()).Where(GetSortMethod()));

            RowCount = 0;
            foreach (ObjectiveViewPanel o in toAdd)
            {
                RowStyles.Add(new RowStyle(SizeType.Absolute, 300f));
                RowCount += 1;
                Controls.Add(o);
                SetCellPosition(o, new TableLayoutPanelCellPosition(1, RowCount - 1));
                SetRowSpan(o, 1);
                SetColumnSpan(o, 1);
            }
            if (Controls.Count == 1)
            {
                RowStyles.Add(new RowStyle(SizeType.Absolute, 273f));
                RowCount += 1;
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// Create a new board control
 /// </summary>
 /// <param name="board">board</param>
 /// <param name="colors">colors for each index</param>
 public BoardControl(Board board, Color[] colors)
 {
     Dock        = DockStyle.Fill;
     this.colors = colors;
     RowCount    = board.Size + 1;
     ColumnCount = board.Size + 1;
     RowStyles.Clear();
     ColumnStyles.Clear();
     for (int i = 0; i < board.Size; i++)
     {
         RowStyles.Add(new RowStyle(SizeType.Absolute, (float)500 / board.Size));
         ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, (float)500 / board.Size));
     }
     for (int i = 0; i < board.Size; i++)
     {
         for (int j = 0; j < board.Size; j++)
         {
             var pbox = new CellControl(board[i, j]);
             pbox.BackColor = colors[pbox.Cell.Color];
             pbox.Click    += (_, __) => { CellClick(_, __); };
             Controls.Add(pbox, j, i);
         }
     }
 }
Exemplo n.º 16
0
        public RaportsForOperators()
        {
            try
            {
                RowStyles.Clear();
                ColumnStyles.Clear();
                RowStyles.Add(new RowStyle(SizeType.Absolute, 120f));
                RowStyles.Add(new RowStyle(SizeType.Absolute, 120f));
                RowStyles.Add(new RowStyle(SizeType.Absolute, 200f));
                RowStyles.Add(new RowStyle(SizeType.Absolute, 150f));

                Dock = DockStyle.Fill;

                Controls.Add(new GroupBox()
                {
                    Name = "202ReportGroupBox",
                    Dock = DockStyle.Fill,
                    Text = "Отчёт для 202",
                }, 0, 0);

                Controls.Add(new GroupBox()
                {
                    Name = "203ReportGroupBox",
                    Dock = DockStyle.Fill,
                    Text = "Отчёт для 203",
                }, 0, 1);

                Controls.Add(new GroupBox()
                {
                    Name = "HistoryGroupBox",
                    Dock = DockStyle.Fill,
                    Text = "История включений",
                }, 0, 2);

                Controls.Add(new Panel()
                {
                    Dock = DockStyle.Fill,
                }, 0, 3);

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new Panel()
                {
                    Name   = "HistoryPanel",
                    Dock   = DockStyle.Top,
                    Text   = "Получить историю",
                    Height = 25,
                });

                Controls.Find("HistoryPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name = "HistoryButton",
                    Dock = DockStyle.Fill,
                    Text = "Получить историю",
                });

                Controls.Find("HistoryPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name  = "HistoryButton1",
                    Dock  = DockStyle.Right,
                    Text  = "Получить min/max",
                    Width = 120,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Name = "HistoryDateTimePicker2",
                    Dock = DockStyle.Top,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Top  = 5,
                    Name = "HistoryDateTimePicker1",
                    Dock = DockStyle.Top,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new GroupBox()
                {
                    Name   = "HistoryPolarizationGroupBox",
                    Dock   = DockStyle.Top,
                    Text   = "Поляризация",
                    Height = 37,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new GroupBox()
                {
                    Name   = "HistoryBeamGroupBox",
                    Dock   = DockStyle.Top,
                    Text   = "Диапазон",
                    Height = 37,
                });

                Controls.Find("HistoryGroupBox", true).FirstOrDefault().Controls.Add(new GroupBox()
                {
                    Name   = "HistorySatelliteGroupBox",
                    Dock   = DockStyle.Top,
                    Text   = "Спутник",
                    Height = 37,
                });

                Controls.Find("HistoryPolarizationGroupBox", true).FirstOrDefault().Controls.Add(new ComboBox()
                {
                    Name          = "HistoryPolarizationComboBox",
                    Dock          = DockStyle.Fill,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                });
                Controls.Find("HistoryBeamGroupBox", true).FirstOrDefault().Controls.Add(new ComboBox()
                {
                    Name          = "HistoryBeamComboBox",
                    Dock          = DockStyle.Fill,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                });
                Controls.Find("HistorySatelliteGroupBox", true).FirstOrDefault().Controls.Add(new ComboBox()
                {
                    Name          = "HistorySatelliteComboBox",
                    Dock          = DockStyle.Fill,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                });


                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("L");
                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("R");
                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("V");
                (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).Items.Add("H");

                foreach (string be in dataBase.SimpleData("FrequencyBand").Rows.Cast <DataRow>().Select(x => x["Наименование диапазона"].ToString()).OrderBy(x => x).ToList())
                {
                    (Controls.Find("HistoryBeamComboBox", true).FirstOrDefault() as ComboBox).Items.Add(be);
                }

                foreach (string be in dataBase.SimpleData("SatelliteList").Rows.Cast <DataRow>().Select(x => x["НаименованиеИСЗ"].ToString()).OrderBy(x => x).ToList())
                {
                    (Controls.Find("HistorySatelliteComboBox", true).FirstOrDefault() as ComboBox).Items.Add(be);
                }


                (Controls.Find("HistoryButton", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    Documentation.WorkingHistory((Controls.Find("HistorySatelliteComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                 (Controls.Find("HistoryBeamComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                 (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                 (Controls.Find("HistoryDateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value,
                                                 Convert.ToInt32(((Controls.Find("HistoryDateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value -
                                                                  (Controls.Find("HistoryDateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value).TotalDays));
                };

                (Controls.Find("HistoryButton1", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    Documentation.WorkingHistoryMinMax((Controls.Find("HistorySatelliteComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                       (Controls.Find("HistoryBeamComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                       (Controls.Find("HistoryPolarizationComboBox", true).FirstOrDefault() as ComboBox).SelectedItem.ToString(),
                                                       (Controls.Find("HistoryDateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value,
                                                       (Controls.Find("HistoryDateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value);
                };

                Controls.Find("202ReportGroupBox", true).FirstOrDefault().Controls.Add(new FlowLayoutPanel()
                {
                    Name = "202ReportGroupBoxFlowLayoutPanel",
                    Dock = DockStyle.Fill,
                });

                Controls.Find("202ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new TableLayoutPanel()
                {
                    Name   = "DailyRaport202TableLayoutPanel",
                    Height = 30,
                });

                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Clear();
                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).RowStyles.Clear();
                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 90f));
                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10f));

                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new DateTimePicker()
                {
                    Name = "DailyRaport202DateTimePicker1",
                }, 0, 0);

                (Controls.Find("DailyRaport202TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new CheckBox()
                {
                    Name = "DailyRaport202CheckBox",
                }, 1, 0);

                Controls.Find("202ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Name    = "DailyRaport202DateTimePicker2",
                    Enabled = false,
                });

                (Controls.Find("DailyRaport202CheckBox", true).FirstOrDefault() as CheckBox).CheckedChanged += (s, e) =>
                {
                    try
                    {
                        if ((Controls.Find("DailyRaport202CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            (Controls.Find("DailyRaport202DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = true;
                            (Controls.Find("TodayReport", true).FirstOrDefault() as Button).Text = "Отчёт за период";
                        }
                        else
                        {
                            (Controls.Find("DailyRaport202DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = false;
                            (Controls.Find("TodayReport", true).FirstOrDefault() as Button).Text = "Ежедневный отчёт";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.DailyRaport202CheckBox " + ex.Message);
                    }
                };

                Controls.Find("202ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name      = "TodayReport",
                    Text      = "Ежедневный отчёт",
                    AutoSize  = true,
                    FlatStyle = FlatStyle.Flat,
                    BackColor = Supports.headGrey,
                    Width     = 200,
                });

                (Controls.Find("TodayReport", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    try
                    {
                        if (!(Controls.Find("DailyRaport202CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            Documentation.Daily202Report((Controls.Find("DailyRaport202DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date);
                        }
                        else
                        {
                            int days = Convert.ToInt32(((Controls.Find("DailyRaport202DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value.Date - (Controls.Find("DailyRaport202DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date).TotalDays);
                            if (days < 0)
                            {
                                MessageBoxTi.Show("Неверно введён период");
                                return;
                            }
                            Documentation.Daily202Report((Controls.Find("DailyRaport202DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date, days);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.TodayReport " + ex.Message);
                    }
                };

                Controls.Find("203ReportGroupBox", true).FirstOrDefault().Controls.Add(new FlowLayoutPanel()
                {
                    Name = "203ReportGroupBoxFlowLayoutPanel",
                    Dock = DockStyle.Fill,
                });

                Controls.Find("203ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new TableLayoutPanel()
                {
                    Name   = "Raport203TableLayoutPanel",
                    Height = 30,
                });

                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Clear();
                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).RowStyles.Clear();
                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 90f));
                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10f));

                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new DateTimePicker()
                {
                    Name = "Raport203DateTimePicker1",
                }, 0, 0);

                (Controls.Find("Raport203TableLayoutPanel", true).FirstOrDefault() as TableLayoutPanel).Controls.Add(new CheckBox()
                {
                    Name = "Raport203CheckBox",
                }, 1, 0);

                Controls.Find("203ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new DateTimePicker()
                {
                    Name    = "Raport203DateTimePicker2",
                    Enabled = false,
                });

                (Controls.Find("Raport203CheckBox", true).FirstOrDefault() as CheckBox).CheckedChanged += (s, e) =>
                {
                    try
                    {
                        if ((Controls.Find("Raport203CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            (Controls.Find("Raport203DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = true;
                            (Controls.Find("Report203", true).FirstOrDefault() as Button).Text = "Отчёт за период";
                        }
                        else
                        {
                            (Controls.Find("Raport203DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Enabled = false;
                            (Controls.Find("Report203", true).FirstOrDefault() as Button).Text = "Отчёт";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.Raport203CheckBox " + ex.Message);
                    }
                };

                Controls.Find("203ReportGroupBoxFlowLayoutPanel", true).FirstOrDefault().Controls.Add(new Button()
                {
                    Name      = "Report203",
                    Text      = "Отчёт",
                    AutoSize  = true,
                    FlatStyle = FlatStyle.Flat,
                    BackColor = Supports.headGrey,
                    Width     = 200,
                });

                (Controls.Find("Report203", true).FirstOrDefault() as Button).Click += (s, e) =>
                {
                    try
                    {
                        if (!(Controls.Find("Raport203CheckBox", true).FirstOrDefault() as CheckBox).Checked)
                        {
                            Documentation.TillCalledFor203Report((Controls.Find("Raport203DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date);
                        }
                        else
                        {
                            int days = Convert.ToInt32(((Controls.Find("Raport203DateTimePicker2", true).FirstOrDefault() as DateTimePicker).Value.Date - (Controls.Find("Raport203DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date).TotalDays);
                            if (days < 0)
                            {
                                MessageBoxTi.Show("Неверно введён период");
                                return;
                            }
                            Documentation.TillCalledFor203Report((Controls.Find("Raport203DateTimePicker1", true).FirstOrDefault() as DateTimePicker).Value.Date, days);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBoxTi.Show("RaportsForOperators.Report203Button " + ex.Message);
                    }
                };
            }
            catch (Exception e)
            {
                MessageBoxTi.Show("RaportsForOperators " + e.Message);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Adding controls in panel
        /// Добавление контролеров на панель
        /// </summary>
        public void SetPosition(Position position)
        {
            m_position = position;
            switch (m_position)
            {
            case Position.Left:
            case Position.Top:
                m_renameCurrentType = CoreDll.RenameCurrentType.First;
                break;

            case Position.Right:
            case Position.Bottom:
                m_renameCurrentType = CoreDll.RenameCurrentType.Second;
                break;
            }

            m_pictureBoxPanel.Position = m_position;

            TableLayoutPanel infoLayout = InitFactory.Layout.Create(7, 1); //number of controls in panel

            infoLayout.Height = m_imageSizeLabel.Height;
            if (m_position != Position.Left)
            {
                m_pathLabel.TextAlign = ContentAlignment.TopLeft;

                m_fileSizeLabel.Margin = new Padding(EBW, 0, 0, 0);
                m_pathLabel.Margin     = new Padding(IBW, 0, EBW, 0);

                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //fileSizeLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageSizeLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageBlocknessLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageBlurringLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageTypeLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageExifLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); //pathLabel

                infoLayout.Controls.Add(m_fileSizeLabel, 0, 0);
                infoLayout.Controls.Add(m_imageSizeLabel, 1, 0);
                infoLayout.Controls.Add(m_imageBlocknessLabel, 2, 0);
                infoLayout.Controls.Add(m_imageBlurringLabel, 3, 0);
                infoLayout.Controls.Add(m_imageTypeLabel, 4, 0);
                infoLayout.Controls.Add(m_imageExifLabel, 5, 0);
                infoLayout.Controls.Add(m_pathLabel, 6, 0);
            }
            else
            {
                m_pathLabel.TextAlign = ContentAlignment.TopRight;

                m_pathLabel.Margin     = new Padding(EBW, 0, 0, 0);
                m_fileSizeLabel.Margin = new Padding(IBW, 0, EBW, 0);

                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); //pathLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageExifLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageTypeLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageBlurringLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageBlocknessLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //imageSizeLabel
                infoLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //fileSizeLabel

                infoLayout.Controls.Add(m_pathLabel, 0, 0);
                infoLayout.Controls.Add(m_imageTypeLabel, 1, 0);
                infoLayout.Controls.Add(m_imageBlurringLabel, 2, 0);
                infoLayout.Controls.Add(m_imageBlocknessLabel, 3, 0);
                infoLayout.Controls.Add(m_imageSizeLabel, 4, 0);
                infoLayout.Controls.Add(m_imageExifLabel, 5, 0);
                infoLayout.Controls.Add(m_fileSizeLabel, 6, 0);
            }

            Controls.Clear();
            RowStyles.Clear();
            if (m_position == Position.Bottom)
            {
                m_pictureBoxPanel.Margin = new Padding(EBW, IBW, EBW, EBW);
                infoLayout.Margin        = new Padding(0, EBW, 0, 0);

                RowStyles.Add(new RowStyle(SizeType.AutoSize));
                RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
                Controls.Add(infoLayout, 0, 0);
                Controls.Add(m_pictureBoxPanel, 0, 1);
            }
            else
            {
                m_pictureBoxPanel.Margin = new Padding(EBW, EBW, EBW, IBW);
                infoLayout.Margin        = new Padding(0, 0, 0, EBW);

                RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
                RowStyles.Add(new RowStyle(SizeType.AutoSize));
                Controls.Add(m_pictureBoxPanel, 0, 0);
                Controls.Add(infoLayout, 0, 1);
            }
        }