using System.Drawing; using System.Windows.Forms; namespace ToyStoreApp; partial class ProductEditForm { private System.ComponentModel.IContainer components = null; private TableLayoutPanel rootLayout; private TextBox articleTextBox; private TextBox nameTextBox; private ComboBox unitComboBox; private NumericUpDown priceNumeric; private ComboBox supplierComboBox; private ComboBox manufacturerComboBox; private ComboBox categoryComboBox; private NumericUpDown discountNumeric; private NumericUpDown stockNumeric; private TextBox descriptionTextBox; private TextBox imageTextBox; private Button chooseImageButton; private Button saveButton; private Button cancelButton; protected override void Dispose(bool disposing) { if (disposing && (components is not null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { rootLayout = new TableLayoutPanel(); articleTextBox = new TextBox(); nameTextBox = new TextBox(); unitComboBox = new ComboBox(); priceNumeric = new NumericUpDown(); supplierComboBox = new ComboBox(); manufacturerComboBox = new ComboBox(); categoryComboBox = new ComboBox(); discountNumeric = new NumericUpDown(); stockNumeric = new NumericUpDown(); descriptionTextBox = new TextBox(); imageTextBox = new TextBox(); chooseImageButton = new Button(); saveButton = new Button(); cancelButton = new Button(); var imagePanel = new FlowLayoutPanel(); var commandPanel = new FlowLayoutPanel(); rootLayout.SuspendLayout(); imagePanel.SuspendLayout(); commandPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)priceNumeric).BeginInit(); ((System.ComponentModel.ISupportInitialize)discountNumeric).BeginInit(); ((System.ComponentModel.ISupportInitialize)stockNumeric).BeginInit(); SuspendLayout(); rootLayout.ColumnCount = 2; rootLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 170F)); rootLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); rootLayout.Dock = DockStyle.Fill; rootLayout.Padding = new Padding(16); rootLayout.RowCount = 12; for (var i = 0; i < 9; i++) { rootLayout.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F)); } rootLayout.RowStyles.Add(new RowStyle(SizeType.Absolute, 96F)); rootLayout.RowStyles.Add(new RowStyle(SizeType.Absolute, 44F)); rootLayout.RowStyles.Add(new RowStyle(SizeType.Absolute, 52F)); AddRow(rootLayout, 0, "Артикул", articleTextBox); AddRow(rootLayout, 1, "Название", nameTextBox); AddRow(rootLayout, 2, "Ед. измерения", unitComboBox); AddRow(rootLayout, 3, "Цена", priceNumeric); AddRow(rootLayout, 4, "Поставщик", supplierComboBox); AddRow(rootLayout, 5, "Производитель", manufacturerComboBox); AddRow(rootLayout, 6, "Категория", categoryComboBox); AddRow(rootLayout, 7, "Скидка", discountNumeric); AddRow(rootLayout, 8, "Остаток", stockNumeric); AddRow(rootLayout, 9, "Описание", descriptionTextBox); AddRow(rootLayout, 10, "Фото", imagePanel); rootLayout.Controls.Add(commandPanel, 1, 11); foreach (Control control in new Control[] { articleTextBox, nameTextBox, unitComboBox, supplierComboBox, manufacturerComboBox, categoryComboBox }) { control.Anchor = AnchorStyles.Left | AnchorStyles.Right; } priceNumeric.DecimalPlaces = 2; priceNumeric.Maximum = 1000000; priceNumeric.Width = 180; discountNumeric.DecimalPlaces = 2; discountNumeric.Maximum = 100; discountNumeric.Width = 180; stockNumeric.Maximum = 1000000; stockNumeric.Width = 180; descriptionTextBox.Dock = DockStyle.Fill; descriptionTextBox.Multiline = true; descriptionTextBox.ScrollBars = ScrollBars.Vertical; imagePanel.Controls.Add(imageTextBox); imagePanel.Controls.Add(chooseImageButton); imagePanel.Dock = DockStyle.Fill; imagePanel.WrapContents = false; imageTextBox.Size = new Size(250, 27); chooseImageButton.Size = new Size(132, 32); chooseImageButton.Text = "Выбрать"; chooseImageButton.Click += ChooseImageButton_Click; commandPanel.Controls.Add(saveButton); commandPanel.Controls.Add(cancelButton); commandPanel.Dock = DockStyle.Fill; commandPanel.FlowDirection = FlowDirection.RightToLeft; saveButton.Size = new Size(115, 34); saveButton.Text = "Сохранить"; saveButton.Click += SaveButton_Click; cancelButton.DialogResult = DialogResult.Cancel; cancelButton.Size = new Size(115, 34); cancelButton.Text = "Отмена"; AcceptButton = saveButton; AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; CancelButton = cancelButton; ClientSize = new Size(620, 588); Controls.Add(rootLayout); FormBorderStyle = FormBorderStyle.FixedDialog; MaximizeBox = false; MinimizeBox = false; StartPosition = FormStartPosition.CenterParent; Text = "Товар"; rootLayout.ResumeLayout(false); rootLayout.PerformLayout(); imagePanel.ResumeLayout(false); imagePanel.PerformLayout(); commandPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)priceNumeric).EndInit(); ((System.ComponentModel.ISupportInitialize)discountNumeric).EndInit(); ((System.ComponentModel.ISupportInitialize)stockNumeric).EndInit(); ResumeLayout(false); } private static void AddRow(TableLayoutPanel table, int row, string text, Control control) { var label = new Label { Dock = DockStyle.Fill, Text = text, TextAlign = ContentAlignment.MiddleLeft }; control.Dock = DockStyle.Fill; table.Controls.Add(label, 0, row); table.Controls.Add(control, 1, row); } }