| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- using System.Drawing;
- using System.Windows.Forms;
- namespace ToyStoreApp;
- partial class ProductListForm
- {
- private System.ComponentModel.IContainer components = null;
- private TableLayoutPanel RootBindingPanel;
- private TableLayoutPanel topLayout;
- private FlowLayoutPanel ToolbarBindingPanel;
- 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 ProductsBindingGrid;
- 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()
- {
- RootBindingPanel = new TableLayoutPanel();
- topLayout = new TableLayoutPanel();
- ToolbarBindingPanel = 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();
- ProductsBindingGrid = 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 };
- RootBindingPanel.SuspendLayout();
- topLayout.SuspendLayout();
- ToolbarBindingPanel.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)ProductsBindingGrid).BeginInit();
- statusStrip.SuspendLayout();
- SuspendLayout();
- RootBindingPanel.ColumnCount = 1;
- RootBindingPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
- RootBindingPanel.Controls.Add(topLayout, 0, 0);
- RootBindingPanel.Controls.Add(ProductsBindingGrid, 0, 1);
- RootBindingPanel.Controls.Add(statusStrip, 0, 2);
- RootBindingPanel.Dock = DockStyle.Fill;
- RootBindingPanel.RowCount = 3;
- RootBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 86F));
- RootBindingPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
- RootBindingPanel.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(ToolbarBindingPanel, 0, 0);
- topLayout.Controls.Add(userInfoLabel, 1, 0);
- topLayout.Dock = DockStyle.Fill;
- topLayout.RowCount = 1;
- topLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
- ToolbarBindingPanel.Controls.Add(searchLabel);
- ToolbarBindingPanel.Controls.Add(searchFieldComboBox);
- ToolbarBindingPanel.Controls.Add(searchTextBox);
- ToolbarBindingPanel.Controls.Add(supplierLabel);
- ToolbarBindingPanel.Controls.Add(supplierComboBox);
- ToolbarBindingPanel.Controls.Add(sortLabel);
- ToolbarBindingPanel.Controls.Add(sortComboBox);
- ToolbarBindingPanel.Controls.Add(addButton);
- ToolbarBindingPanel.Controls.Add(editButton);
- ToolbarBindingPanel.Controls.Add(deleteButton);
- ToolbarBindingPanel.Controls.Add(ordersButton);
- ToolbarBindingPanel.Controls.Add(exitButton);
- ToolbarBindingPanel.Dock = DockStyle.Fill;
- ToolbarBindingPanel.Padding = new Padding(8, 7, 8, 4);
- ToolbarBindingPanel.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;
- ProductsBindingGrid.AllowUserToAddRows = false;
- ProductsBindingGrid.AllowUserToDeleteRows = false;
- ProductsBindingGrid.AutoGenerateColumns = false;
- ProductsBindingGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
- ProductsBindingGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- ProductsBindingGrid.Columns.AddRange(new DataGridViewColumn[] { articleColumn, nameColumn, categoryColumn, manufacturerColumn, supplierColumn, priceColumn, discountColumn, finalPriceColumn, stockColumn });
- ProductsBindingGrid.Dock = DockStyle.Fill;
- ProductsBindingGrid.MultiSelect = false;
- ProductsBindingGrid.ReadOnly = true;
- ProductsBindingGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
- ProductsBindingGrid.CellDoubleClick += ProductsGrid_CellDoubleClick;
- ProductsBindingGrid.RowPrePaint += ProductsGrid_RowPrePaint;
- statusStrip.Items.AddRange(new ToolStripItem[] { countStatusLabel });
- countStatusLabel.Text = "Товаров: 0";
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1320, 760);
- Controls.Add(RootBindingPanel);
- MinimumSize = new Size(1060, 620);
- StartPosition = FormStartPosition.CenterScreen;
- Text = $"{AppearanceSettings.ProductListTitle} [V02]";
- BackColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor);
- topLayout.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor);
- ToolbarBindingPanel.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor);
- userInfoLabel.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor);
- ProductsBindingGrid.BackgroundColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor);
- addButton.BackColor = ColorTranslator.FromHtml(AppearanceSettings.AccentColor);
- addButton.UseVisualStyleBackColor = false;
- Load += ProductListForm_Load;
- RootBindingPanel.ResumeLayout(false);
- RootBindingPanel.PerformLayout();
- topLayout.ResumeLayout(false);
- ToolbarBindingPanel.ResumeLayout(false);
- ToolbarBindingPanel.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)ProductsBindingGrid).EndInit();
- statusStrip.ResumeLayout(false);
- statusStrip.PerformLayout();
- ResumeLayout(false);
- }
- }
|