using System.Drawing; using System.Windows.Forms; namespace ToyStoreApp; partial class ProductDetailsForm { private System.ComponentModel.IContainer components = null; private Panel PhotoBindingPanel; private PictureBox productPictureBox; private Label photoPlaceholderLabel; private TableLayoutPanel DetailsBindingPanel; private Label titleLabel; private Label descriptionLabel; private Label descriptionValueLabel; private Label manufacturerLabel; private Label manufacturerValueLabel; private Label supplierLabel; private Label supplierValueLabel; private Label priceLabel; private Label priceValueLabel; private FlowLayoutPanel pricePanel; private Label OriginalPriceBindingLabel; private Label unitLabel; private Label unitValueLabel; private Label stockLabel; private Label stockValueLabel; private Label articleLabel; private Label articleValueLabel; private Panel DiscountBindingContainer; private Label discountTitleLabel; private Label DiscountValueBindingLabel; private Label finalPriceTitleLabel; private Label finalPriceValueLabel; private Button closeButton; protected override void Dispose(bool disposing) { if (disposing) { productPictureBox?.Image?.Dispose(); components?.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { PhotoBindingPanel = new Panel(); productPictureBox = new PictureBox(); photoPlaceholderLabel = new Label(); DetailsBindingPanel = new TableLayoutPanel(); titleLabel = new Label(); descriptionLabel = new Label(); descriptionValueLabel = new Label(); manufacturerLabel = new Label(); manufacturerValueLabel = new Label(); supplierLabel = new Label(); supplierValueLabel = new Label(); priceLabel = new Label(); priceValueLabel = new Label(); OriginalPriceBindingLabel = new Label(); unitLabel = new Label(); unitValueLabel = new Label(); stockLabel = new Label(); stockValueLabel = new Label(); articleLabel = new Label(); articleValueLabel = new Label(); DiscountBindingContainer = new Panel(); discountTitleLabel = new Label(); DiscountValueBindingLabel = new Label(); finalPriceTitleLabel = new Label(); finalPriceValueLabel = new Label(); closeButton = new Button(); PhotoBindingPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)productPictureBox).BeginInit(); DetailsBindingPanel.SuspendLayout(); DiscountBindingContainer.SuspendLayout(); SuspendLayout(); PhotoBindingPanel.BorderStyle = BorderStyle.FixedSingle; PhotoBindingPanel.Location = new Point(10, 10); PhotoBindingPanel.Margin = new Padding(3); PhotoBindingPanel.Size = new Size(270, 410); PhotoBindingPanel.Controls.Add(productPictureBox); PhotoBindingPanel.Controls.Add(photoPlaceholderLabel); productPictureBox.Dock = DockStyle.Fill; productPictureBox.SizeMode = PictureBoxSizeMode.Zoom; photoPlaceholderLabel.AutoSize = false; photoPlaceholderLabel.Dock = DockStyle.Fill; photoPlaceholderLabel.Font = new Font("Segoe UI", 11F, FontStyle.Bold); photoPlaceholderLabel.Text = "Фото"; photoPlaceholderLabel.TextAlign = ContentAlignment.MiddleCenter; DetailsBindingPanel.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; DetailsBindingPanel.ColumnCount = 2; DetailsBindingPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 160F)); DetailsBindingPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); DetailsBindingPanel.Location = new Point(293, 10); DetailsBindingPanel.Margin = new Padding(3); DetailsBindingPanel.Size = new Size(450, 410); pricePanel = new FlowLayoutPanel(); pricePanel.FlowDirection = FlowDirection.LeftToRight; pricePanel.Dock = DockStyle.Fill; pricePanel.AutoSize = true; pricePanel.WrapContents = false; pricePanel.Padding = new Padding(0); pricePanel.Margin = new Padding(0); DetailsBindingPanel.Controls.Add(titleLabel, 0, 0); DetailsBindingPanel.Controls.Add(descriptionLabel, 0, 1); DetailsBindingPanel.Controls.Add(descriptionValueLabel, 1, 1); DetailsBindingPanel.Controls.Add(manufacturerLabel, 0, 2); DetailsBindingPanel.Controls.Add(manufacturerValueLabel, 1, 2); DetailsBindingPanel.Controls.Add(supplierLabel, 0, 3); DetailsBindingPanel.Controls.Add(supplierValueLabel, 1, 3); DetailsBindingPanel.Controls.Add(priceLabel, 0, 4); // Place both price labels into a FlowLayoutPanel so they share the same row DetailsBindingPanel.Controls.Add(pricePanel, 1, 4); pricePanel.Controls.Add(priceValueLabel); pricePanel.Controls.Add(OriginalPriceBindingLabel); DetailsBindingPanel.Controls.Add(unitLabel, 0, 5); DetailsBindingPanel.Controls.Add(unitValueLabel, 1, 5); DetailsBindingPanel.Controls.Add(stockLabel, 0, 6); DetailsBindingPanel.Controls.Add(stockValueLabel, 1, 6); DetailsBindingPanel.Controls.Add(articleLabel, 0, 7); DetailsBindingPanel.Controls.Add(articleValueLabel, 1, 7); DetailsBindingPanel.Margin = new Padding(3); DetailsBindingPanel.RowCount = 8; DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 54F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 42F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 42F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 42F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 42F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 42F)); DetailsBindingPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 42F)); titleLabel.AutoSize = true; DetailsBindingPanel.SetColumnSpan(titleLabel, 2); titleLabel.Dock = DockStyle.Fill; titleLabel.Font = new Font("Segoe UI", 12F, FontStyle.Bold); titleLabel.Padding = new Padding(8); titleLabel.TextAlign = ContentAlignment.MiddleLeft; ConfigureCaption(descriptionLabel, "Описание товара:"); ConfigureValue(descriptionValueLabel); descriptionValueLabel.AutoEllipsis = true; ConfigureCaption(manufacturerLabel, "Производитель:"); ConfigureValue(manufacturerValueLabel); ConfigureCaption(supplierLabel, "Поставщик:"); ConfigureValue(supplierValueLabel); ConfigureCaption(priceLabel, "Цена:"); ConfigureValue(priceValueLabel); // priceValueLabel is placed inside a FlowLayoutPanel; make it autosize and left-docked so it appears // correctly when generated into the FlowLayoutPanel cell. priceValueLabel.AutoSize = true; priceValueLabel.Dock = DockStyle.Left; priceValueLabel.Padding = new Padding(6); priceValueLabel.TextAlign = ContentAlignment.MiddleLeft; OriginalPriceBindingLabel.AutoSize = true; OriginalPriceBindingLabel.Dock = DockStyle.Fill; OriginalPriceBindingLabel.Font = new Font("Segoe UI", 9F, FontStyle.Strikeout); OriginalPriceBindingLabel.ForeColor = Color.Red; OriginalPriceBindingLabel.Padding = new Padding(6); OriginalPriceBindingLabel.TextAlign = ContentAlignment.MiddleLeft; OriginalPriceBindingLabel.Visible = false; ConfigureCaption(unitLabel, "Единица измерения:"); ConfigureValue(unitValueLabel); ConfigureCaption(stockLabel, "Количество на складе:"); ConfigureValue(stockValueLabel); ConfigureCaption(articleLabel, "Артикул:"); ConfigureValue(articleValueLabel); DiscountBindingContainer.BorderStyle = BorderStyle.FixedSingle; DiscountBindingContainer.Dock = DockStyle.Right; DiscountBindingContainer.Width = 220; DiscountBindingContainer.Margin = new Padding(3); // Add controls in reverse so Dock=Top produces top-to-bottom visual order DiscountBindingContainer.Controls.Add(closeButton); DiscountBindingContainer.Controls.Add(finalPriceValueLabel); DiscountBindingContainer.Controls.Add(finalPriceTitleLabel); DiscountBindingContainer.Controls.Add(DiscountValueBindingLabel); DiscountBindingContainer.Controls.Add(discountTitleLabel); discountTitleLabel.AutoSize = false; discountTitleLabel.Dock = DockStyle.Top; discountTitleLabel.Font = new Font("Segoe UI", 11F, FontStyle.Bold); discountTitleLabel.Height = 54; discountTitleLabel.Text = "Действующая скидка"; discountTitleLabel.TextAlign = ContentAlignment.MiddleCenter; DiscountValueBindingLabel.AutoSize = false; DiscountValueBindingLabel.Dock = DockStyle.Top; DiscountValueBindingLabel.Font = new Font("Segoe UI", 24F, FontStyle.Bold); DiscountValueBindingLabel.ForeColor = Color.Black; DiscountValueBindingLabel.Height = 70; DiscountValueBindingLabel.TextAlign = ContentAlignment.MiddleCenter; finalPriceTitleLabel.AutoSize = false; finalPriceTitleLabel.Dock = DockStyle.Top; finalPriceTitleLabel.Font = new Font("Segoe UI", 9F, FontStyle.Bold); finalPriceTitleLabel.Height = 35; finalPriceTitleLabel.Text = "Цена со скидкой"; finalPriceTitleLabel.TextAlign = ContentAlignment.MiddleCenter; finalPriceValueLabel.AutoSize = false; finalPriceValueLabel.Dock = DockStyle.Top; finalPriceValueLabel.Font = new Font("Segoe UI", 13F, FontStyle.Bold); finalPriceValueLabel.Height = 50; finalPriceValueLabel.TextAlign = ContentAlignment.MiddleCenter; closeButton.Dock = DockStyle.Bottom; closeButton.Height = 36; closeButton.Margin = new Padding(8); closeButton.Text = "Закрыть"; closeButton.UseVisualStyleBackColor = true; closeButton.Click += CloseButton_Click; AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.Window; ClientSize = new Size(1040, 450); Controls.Add(DiscountBindingContainer); Controls.Add(DetailsBindingPanel); Controls.Add(PhotoBindingPanel); MinimumSize = new Size(900, 420); StartPosition = FormStartPosition.CenterParent; Text = AppearanceSettings.ProductDetailsTitle; BackColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); PhotoBindingPanel.BackColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); DetailsBindingPanel.BackColor = ColorTranslator.FromHtml(AppearanceSettings.MainBackgroundColor); DiscountBindingContainer.BackColor = ColorTranslator.FromHtml(AppearanceSettings.SecondaryBackgroundColor); Load += ProductDetailsForm_Load; PhotoBindingPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)productPictureBox).EndInit(); DetailsBindingPanel.ResumeLayout(false); DetailsBindingPanel.PerformLayout(); DiscountBindingContainer.ResumeLayout(false); ResumeLayout(false); } private static void ConfigureCaption(Label label, string text) { label.Dock = DockStyle.Fill; label.Font = new Font("Segoe UI", 9F, FontStyle.Bold); label.Padding = new Padding(6); label.Text = text; label.TextAlign = ContentAlignment.MiddleLeft; } private static void ConfigureValue(Label label) { label.Dock = DockStyle.Fill; label.Padding = new Padding(6); label.TextAlign = ContentAlignment.MiddleLeft; } }