using System.Drawing; using System.Windows.Forms; namespace ToyStoreApp; partial class OrderListForm { private System.ComponentModel.IContainer components = null; private TableLayoutPanel rootLayout; private FlowLayoutPanel toolbarPanel; private Button addButton; private Button editButton; private Button refreshButton; private Button deleteButton; private DataGridView ordersGrid; protected override void Dispose(bool disposing) { if (disposing && (components is not null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { rootLayout = new TableLayoutPanel(); toolbarPanel = new FlowLayoutPanel(); addButton = new Button(); editButton = new Button(); refreshButton = new Button(); deleteButton = new Button(); ordersGrid = new DataGridView(); var orderIdColumn = new DataGridViewTextBoxColumn { DataPropertyName = "OrderId", HeaderText = "Номер", MinimumWidth = 70, Name = "orderIdColumn", ReadOnly = true }; var customerColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Customer", HeaderText = "Клиент", MinimumWidth = 120, Name = "customerColumn", ReadOnly = true }; var pickupPointColumn = new DataGridViewTextBoxColumn { DataPropertyName = "PickupPoint", FillWeight = 150F, HeaderText = "Пункт выдачи", MinimumWidth = 160, Name = "pickupPointColumn", ReadOnly = true }; var statusColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Status", HeaderText = "Статус", MinimumWidth = 100, Name = "statusColumn", ReadOnly = true }; var orderDateColumn = new DataGridViewTextBoxColumn { DataPropertyName = "OrderDate", HeaderText = "Дата заказа", MinimumWidth = 110, Name = "orderDateColumn", ReadOnly = true }; var deliveryDateColumn = new DataGridViewTextBoxColumn { DataPropertyName = "DeliveryDate", HeaderText = "Дата выдачи", MinimumWidth = 110, Name = "deliveryDateColumn", ReadOnly = true }; var receiveCodeColumn = new DataGridViewTextBoxColumn { DataPropertyName = "ReceiveCode", HeaderText = "Код", MinimumWidth = 70, Name = "receiveCodeColumn", ReadOnly = true }; var articlesColumn = new DataGridViewTextBoxColumn { DataPropertyName = "Articles", FillWeight = 140F, HeaderText = "Состав", MinimumWidth = 140, Name = "articlesColumn", ReadOnly = true }; rootLayout.SuspendLayout(); toolbarPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)ordersGrid).BeginInit(); SuspendLayout(); rootLayout.ColumnCount = 1; rootLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); rootLayout.Controls.Add(toolbarPanel, 0, 0); rootLayout.Controls.Add(ordersGrid, 0, 1); rootLayout.Dock = DockStyle.Fill; rootLayout.RowCount = 2; rootLayout.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F)); rootLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); toolbarPanel.Controls.Add(addButton); toolbarPanel.Controls.Add(editButton); toolbarPanel.Controls.Add(refreshButton); toolbarPanel.Controls.Add(deleteButton); toolbarPanel.Dock = DockStyle.Fill; toolbarPanel.Padding = new Padding(8, 6, 8, 4); addButton.Size = new Size(104, 32); addButton.Text = "Добавить"; addButton.Click += AddButton_Click; editButton.Size = new Size(120, 32); editButton.Text = "Изменить"; editButton.Click += EditButton_Click; refreshButton.Size = new Size(104, 32); refreshButton.Text = "Обновить"; refreshButton.Click += RefreshButton_Click; deleteButton.Size = new Size(104, 32); deleteButton.Text = "Удалить"; deleteButton.Click += DeleteButton_Click; ordersGrid.AllowUserToAddRows = false; ordersGrid.AllowUserToDeleteRows = false; ordersGrid.AutoGenerateColumns = false; ordersGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; ordersGrid.Columns.AddRange(new DataGridViewColumn[] { orderIdColumn, customerColumn, pickupPointColumn, statusColumn, orderDateColumn, deliveryDateColumn, receiveCodeColumn, articlesColumn }); ordersGrid.Dock = DockStyle.Fill; ordersGrid.MultiSelect = false; ordersGrid.ReadOnly = true; ordersGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; ordersGrid.CellDoubleClick += OrdersGrid_CellDoubleClick; AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1040, 600); Controls.Add(rootLayout); MinimumSize = new Size(900, 520); StartPosition = FormStartPosition.CenterParent; Text = AppearanceSettings.OrderListTitle; BackColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); ordersGrid.BackgroundColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); addButton.BackColor = ColorTranslator.FromHtml(AppearanceSettings.AccentColor); addButton.UseVisualStyleBackColor = false; Load += OrderListForm_Load; rootLayout.ResumeLayout(false); toolbarPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)ordersGrid).EndInit(); ResumeLayout(false); } }