using System.Drawing; using System.Windows.Forms; namespace TradeApp.WinForms.V08; partial class ProductListForm { private System.ComponentModel.IContainer components = null; private TableLayoutPanel AsyncTaskRoot; private TableLayoutPanel topLayout; private FlowLayoutPanel AsyncTaskToolbar; private Label userInfoLabel; private Label searchLabel; private ComboBox searchFieldComboBox; private TextBox searchTextBox; private Label supplierLabel; private ComboBox supplierComboBox; private Label sortLabel; private ComboBox sortComboBox; private Button addButton; private Button editButton; private Button deleteButton; private Button ordersButton; private Button exitButton; private DataGridView AsyncTaskDataGrid; private StatusStrip statusStrip; private ToolStripStatusLabel countStatusLabel; protected override void Dispose(bool disposing) { if (disposing && (components is not null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { AsyncTaskRoot = new TableLayoutPanel(); topLayout = new TableLayoutPanel(); AsyncTaskToolbar = new FlowLayoutPanel(); userInfoLabel = new Label(); searchLabel = new Label(); searchFieldComboBox = new ComboBox(); searchTextBox = new TextBox(); supplierLabel = new Label(); supplierComboBox = new ComboBox(); sortLabel = new Label(); sortComboBox = new ComboBox(); addButton = new Button(); editButton = new Button(); deleteButton = new Button(); ordersButton = new Button(); exitButton = new Button(); AsyncTaskDataGrid = new DataGridView(); statusStrip = new StatusStrip(); countStatusLabel = new ToolStripStatusLabel(); var articleColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Article", HeaderText = "Артикул", MinimumWidth = 80, Name = "articleColumn", ReadOnly = true }; var nameColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Name", FillWeight = 150F, HeaderText = "Название", MinimumWidth = 160, Name = "nameColumn", ReadOnly = true }; var categoryColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Category", HeaderText = "Категория", MinimumWidth = 120, Name = "categoryColumn", ReadOnly = true }; var manufacturerColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Manufacturer", HeaderText = "Производитель", MinimumWidth = 120, Name = "manufacturerColumn", ReadOnly = true }; var supplierColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Supplier", HeaderText = "Поставщик", MinimumWidth = 120, Name = "supplierColumn", ReadOnly = true }; var priceColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Price", HeaderText = "Цена", MinimumWidth = 80, Name = "priceColumn", ReadOnly = true }; var discountColumn = new DataGridViewTextBoxColumn { DataPropertyName = "DiscountPercent", HeaderText = "Скидка", MinimumWidth = 80, Name = "discountColumn", ReadOnly = true }; var finalPriceColumn = new DataGridViewTextBoxColumn { DataPropertyName = "FinalPrice", HeaderText = "Цена со скидкой", MinimumWidth = 110, Name = "finalPriceColumn", ReadOnly = true }; var stockColumn = new DataGridViewTextBoxColumn { DataPropertyName = "StockQuantity", HeaderText = "Остаток", MinimumWidth = 80, Name = "stockColumn", ReadOnly = true }; AsyncTaskRoot.SuspendLayout(); topLayout.SuspendLayout(); AsyncTaskToolbar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)AsyncTaskDataGrid).BeginInit(); statusStrip.SuspendLayout(); SuspendLayout(); AsyncTaskRoot.ColumnCount = 1; AsyncTaskRoot.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); AsyncTaskRoot.Controls.Add(topLayout, 0, 0); AsyncTaskRoot.Controls.Add(AsyncTaskDataGrid, 0, 1); AsyncTaskRoot.Controls.Add(statusStrip, 0, 2); AsyncTaskRoot.Dock = DockStyle.Fill; AsyncTaskRoot.RowCount = 3; AsyncTaskRoot.RowStyles.Add(new RowStyle(SizeType.Absolute, 86F)); AsyncTaskRoot.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); AsyncTaskRoot.RowStyles.Add(new RowStyle(SizeType.Absolute, 26F)); topLayout.ColumnCount = 2; topLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); topLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 300F)); topLayout.Controls.Add(AsyncTaskToolbar, 0, 0); topLayout.Controls.Add(userInfoLabel, 1, 0); topLayout.Dock = DockStyle.Fill; topLayout.RowCount = 1; topLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); AsyncTaskToolbar.Controls.Add(searchLabel); AsyncTaskToolbar.Controls.Add(searchFieldComboBox); AsyncTaskToolbar.Controls.Add(searchTextBox); AsyncTaskToolbar.Controls.Add(supplierLabel); AsyncTaskToolbar.Controls.Add(supplierComboBox); AsyncTaskToolbar.Controls.Add(sortLabel); AsyncTaskToolbar.Controls.Add(sortComboBox); AsyncTaskToolbar.Controls.Add(addButton); AsyncTaskToolbar.Controls.Add(editButton); AsyncTaskToolbar.Controls.Add(deleteButton); AsyncTaskToolbar.Controls.Add(ordersButton); AsyncTaskToolbar.Controls.Add(exitButton); AsyncTaskToolbar.Dock = DockStyle.Fill; AsyncTaskToolbar.Padding = new Padding(8, 7, 8, 4); AsyncTaskToolbar.WrapContents = true; userInfoLabel.Dock = DockStyle.Fill; userInfoLabel.Font = new Font("Segoe UI", 9F, FontStyle.Bold); userInfoLabel.Padding = new Padding(8, 7, 12, 4); userInfoLabel.TextAlign = ContentAlignment.MiddleRight; searchLabel.AutoSize = true; searchLabel.Margin = new Padding(3, 6, 4, 0); searchLabel.Text = "Поиск"; searchFieldComboBox.DropDownStyle = ComboBoxStyle.DropDownList; searchFieldComboBox.Items.AddRange(new object[] { "Везде", "Артикул", "Наименование", "Категория", "Описание", "Производитель", "Поставщик", "Единица измерения", "Цена", "Скидка", "Цена со скидкой", "Количество на складе" }); searchFieldComboBox.Size = new Size(155, 28); searchFieldComboBox.SelectedIndex = 0; searchFieldComboBox.SelectedIndexChanged += SearchFieldComboBox_SelectedIndexChanged; searchTextBox.Size = new Size(170, 27); searchTextBox.TextChanged += SearchTextBox_TextChanged; supplierLabel.AutoSize = true; supplierLabel.Margin = new Padding(4, 6, 4, 0); supplierLabel.Text = "Поставщик"; supplierComboBox.DropDownStyle = ComboBoxStyle.DropDownList; supplierComboBox.Size = new Size(165, 28); supplierComboBox.SelectedIndexChanged += SupplierComboBox_SelectedIndexChanged; sortLabel.AutoSize = true; sortLabel.Margin = new Padding(4, 6, 4, 0); sortLabel.Text = "Сортировка"; sortComboBox.DropDownStyle = ComboBoxStyle.DropDownList; sortComboBox.Items.AddRange(new object[] { "Название", "Цена по возрастанию", "Цена по убыванию", "Остаток по возрастанию", "Остаток по убыванию" }); sortComboBox.Size = new Size(175, 28); sortComboBox.SelectedIndex = 0; sortComboBox.SelectedIndexChanged += SortComboBox_SelectedIndexChanged; addButton.Size = new Size(96, 32); addButton.Text = "Добавить"; addButton.UseVisualStyleBackColor = true; addButton.Click += AddButton_Click; editButton.Size = new Size(120, 32); editButton.Text = "Изменить"; editButton.UseVisualStyleBackColor = true; editButton.Click += EditButton_Click; deleteButton.Size = new Size(96, 32); deleteButton.Text = "Удалить"; deleteButton.UseVisualStyleBackColor = true; deleteButton.Click += DeleteButton_Click; ordersButton.Size = new Size(96, 32); ordersButton.Text = "Заказы"; ordersButton.UseVisualStyleBackColor = true; ordersButton.Click += OrdersButton_Click; exitButton.Size = new Size(82, 32); exitButton.Text = "Выход"; exitButton.UseVisualStyleBackColor = true; exitButton.Click += ExitButton_Click; AsyncTaskDataGrid.AllowUserToAddRows = false; AsyncTaskDataGrid.AllowUserToDeleteRows = false; AsyncTaskDataGrid.AutoGenerateColumns = false; AsyncTaskDataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; AsyncTaskDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; AsyncTaskDataGrid.Columns.AddRange(new DataGridViewColumn[] { articleColumn, nameColumn, categoryColumn, manufacturerColumn, supplierColumn, priceColumn, discountColumn, finalPriceColumn, stockColumn }); AsyncTaskDataGrid.Dock = DockStyle.Fill; AsyncTaskDataGrid.MultiSelect = false; AsyncTaskDataGrid.ReadOnly = true; AsyncTaskDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; AsyncTaskDataGrid.CellDoubleClick += ProductsGrid_CellDoubleClick; AsyncTaskDataGrid.RowPrePaint += ProductsGrid_RowPrePaint; statusStrip.Items.AddRange(new ToolStripItem[] { countStatusLabel }); countStatusLabel.Text = "Товаров: 0"; AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1360, 780); Controls.Add(AsyncTaskRoot); MinimumSize = new Size(1080, 620); StartPosition = FormStartPosition.CenterScreen; Text = $"{AppearanceSettings.ProductListTitle} [V08]"; BackColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); topLayout.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor); AsyncTaskToolbar.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor); userInfoLabel.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor); AsyncTaskDataGrid.BackgroundColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); addButton.BackColor = ColorTranslator.FromHtml(AppearanceSettings.AccentColor); addButton.UseVisualStyleBackColor = false; Load += ProductListForm_Load; AsyncTaskRoot.ResumeLayout(false); AsyncTaskRoot.PerformLayout(); topLayout.ResumeLayout(false); AsyncTaskToolbar.ResumeLayout(false); AsyncTaskToolbar.PerformLayout(); ((System.ComponentModel.ISupportInitialize)AsyncTaskDataGrid).EndInit(); statusStrip.ResumeLayout(false); statusStrip.PerformLayout(); ResumeLayout(false); } }