фиксы для красоты

This commit is contained in:
the 2024-06-24 17:09:03 +04:00
parent 8706337153
commit b055d523bf
2 changed files with 42 additions and 8 deletions

View File

@ -35,8 +35,10 @@
buttonSelectFile = new Button(); buttonSelectFile = new Button();
labelFile = new Label(); labelFile = new Label();
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
dataGridView = new DataGridView();
groupBoxFiles.SuspendLayout(); groupBoxFiles.SuspendLayout();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// groupBoxFiles // groupBoxFiles
@ -45,10 +47,10 @@
groupBoxFiles.Dock = DockStyle.Left; groupBoxFiles.Dock = DockStyle.Left;
groupBoxFiles.Location = new Point(0, 0); groupBoxFiles.Location = new Point(0, 0);
groupBoxFiles.Name = "groupBoxFiles"; groupBoxFiles.Name = "groupBoxFiles";
groupBoxFiles.Size = new Size(282, 439); groupBoxFiles.Size = new Size(282, 586);
groupBoxFiles.TabIndex = 0; groupBoxFiles.TabIndex = 0;
groupBoxFiles.TabStop = false; groupBoxFiles.TabStop = false;
groupBoxFiles.Text = айлы"; groupBoxFiles.Text = отографии";
// //
// panelFiles // panelFiles
// //
@ -56,7 +58,7 @@
panelFiles.Dock = DockStyle.Fill; panelFiles.Dock = DockStyle.Fill;
panelFiles.Location = new Point(3, 19); panelFiles.Location = new Point(3, 19);
panelFiles.Name = "panelFiles"; panelFiles.Name = "panelFiles";
panelFiles.Size = new Size(276, 417); panelFiles.Size = new Size(276, 564);
panelFiles.TabIndex = 0; panelFiles.TabIndex = 0;
// //
// comboBoxProduct // comboBoxProduct
@ -104,18 +106,28 @@
groupBox1.Controls.Add(buttonAdd); groupBox1.Controls.Add(buttonAdd);
groupBox1.Controls.Add(buttonSelectFile); groupBox1.Controls.Add(buttonSelectFile);
groupBox1.Dock = DockStyle.Right; groupBox1.Dock = DockStyle.Right;
groupBox1.Location = new Point(466, 0); groupBox1.Location = new Point(678, 0);
groupBox1.Name = "groupBox1"; groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(200, 439); groupBox1.Size = new Size(200, 586);
groupBox1.TabIndex = 5; groupBox1.TabIndex = 5;
groupBox1.TabStop = false; groupBox1.TabStop = false;
groupBox1.Text = "groupBox1"; groupBox1.Text = "groupBox1";
// //
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(282, 0);
dataGridView.Name = "dataGridView";
dataGridView.Size = new Size(396, 586);
dataGridView.TabIndex = 6;
//
// FormMediaFiles // FormMediaFiles
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(666, 439); ClientSize = new Size(878, 586);
Controls.Add(dataGridView);
Controls.Add(groupBox1); Controls.Add(groupBox1);
Controls.Add(groupBoxFiles); Controls.Add(groupBoxFiles);
Name = "FormMediaFiles"; Name = "FormMediaFiles";
@ -125,6 +137,7 @@
groupBoxFiles.ResumeLayout(false); groupBoxFiles.ResumeLayout(false);
groupBox1.ResumeLayout(false); groupBox1.ResumeLayout(false);
groupBox1.PerformLayout(); groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }
@ -137,5 +150,6 @@
private Label labelFile; private Label labelFile;
private GroupBox groupBox1; private GroupBox groupBox1;
private Panel panelFiles; private Panel panelFiles;
private DataGridView dataGridView;
} }
} }

View File

@ -33,6 +33,19 @@ namespace WinFormsApp
private void LoadData() private void LoadData()
{ {
if (comboBoxProduct.SelectedIndex < 0) return; if (comboBoxProduct.SelectedIndex < 0) return;
_logger.LogInformation("Загрузка файлов");
try
{
var filelist = _mediafileLogic.ReadList(null);
if (filelist != null)
{
dataGridView.DataSource = filelist;
}
}
catch (Exception ex)
{
}
var list = _mediafileLogic.ReadList(new MediaFileSearchModel() var list = _mediafileLogic.ReadList(new MediaFileSearchModel()
{ {
ProductId = (Guid?)comboBoxProduct.SelectedValue ?? Guid.Empty, ProductId = (Guid?)comboBoxProduct.SelectedValue ?? Guid.Empty,
@ -47,6 +60,13 @@ namespace WinFormsApp
panelFiles.Controls.Add(imageBox); panelFiles.Controls.Add(imageBox);
imageBox.SizeMode = PictureBoxSizeMode.Zoom; imageBox.SizeMode = PictureBoxSizeMode.Zoom;
imageBox.Height = 400; imageBox.Height = 400;
imageBox.BorderStyle = BorderStyle.FixedSingle;
var imageLabel = new Label();
imageLabel.Text = item.Name;
imageLabel.Dock = DockStyle.Top;
imageLabel.TextAlign = ContentAlignment.MiddleCenter;
panelFiles.Controls.Add(imageLabel);
panelFiles.Refresh(); panelFiles.Refresh();
} }
@ -99,13 +119,13 @@ namespace WinFormsApp
if (dialog.ShowDialog() == DialogResult.OK) if (dialog.ShowDialog() == DialogResult.OK)
{ {
_filename = dialog.FileName; _filename = dialog.FileName;
labelFile.Text = System.IO.Path.GetDirectoryName(_filename); labelFile.Text = System.IO.Path.GetFileName(_filename);
} }
} }
private void FormMediaFiles_Resize(object sender, EventArgs e) private void FormMediaFiles_Resize(object sender, EventArgs e)
{ {
panelFiles.Width = Convert.ToInt32(this.Width * 0.5); groupBoxFiles.Width = Convert.ToInt32(this.Width * 0.4);
panelFiles.Height = this.Height; panelFiles.Height = this.Height;
foreach (var control in this.Controls.OfType<PictureBox>()) foreach (var control in this.Controls.OfType<PictureBox>())
{ {