Move Form1 layout into designer

This commit is contained in:
2026-06-30 22:07:04 +09:00
parent 8e58723b34
commit 46e3c22431
2 changed files with 236 additions and 129 deletions

View File

@@ -1,4 +1,3 @@
namespace mbn_stock
{
partial class Form1
@@ -24,18 +23,244 @@ namespace mbn_stock
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this._splitContainer = new System.Windows.Forms.SplitContainer();
this._leftPanel = new System.Windows.Forms.Panel();
this._grid = new System.Windows.Forms.DataGridView();
this._nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this._capColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this._rateColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this._toolbar = new System.Windows.Forms.FlowLayoutPanel();
this._randomButton = new System.Windows.Forms.Button();
this._saveButton = new System.Windows.Forms.Button();
this._statusLabel = new System.Windows.Forms.Label();
this._previewPanel = new System.Windows.Forms.Panel();
this._previewBox = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this._splitContainer)).BeginInit();
this._splitContainer.Panel1.SuspendLayout();
this._splitContainer.Panel2.SuspendLayout();
this._splitContainer.SuspendLayout();
this._leftPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._grid)).BeginInit();
this._toolbar.SuspendLayout();
this._previewPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._previewBox)).BeginInit();
this.SuspendLayout();
//
// _splitContainer
//
this._splitContainer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(210)))), ((int)(((byte)(214)))), ((int)(((byte)(220)))));
this._splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this._splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this._splitContainer.Location = new System.Drawing.Point(0, 0);
this._splitContainer.Name = "_splitContainer";
//
// _splitContainer.Panel1
//
this._splitContainer.Panel1.Controls.Add(this._leftPanel);
this._splitContainer.Panel1MinSize = 420;
//
// _splitContainer.Panel2
//
this._splitContainer.Panel2.Controls.Add(this._previewPanel);
this._splitContainer.Panel2MinSize = 520;
this._splitContainer.Size = new System.Drawing.Size(1280, 760);
this._splitContainer.SplitterDistance = 500;
this._splitContainer.TabIndex = 0;
//
// _leftPanel
//
this._leftPanel.BackColor = System.Drawing.Color.White;
this._leftPanel.Controls.Add(this._grid);
this._leftPanel.Controls.Add(this._toolbar);
this._leftPanel.Controls.Add(this._statusLabel);
this._leftPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._leftPanel.Location = new System.Drawing.Point(0, 0);
this._leftPanel.Name = "_leftPanel";
this._leftPanel.Padding = new System.Windows.Forms.Padding(14);
this._leftPanel.Size = new System.Drawing.Size(500, 760);
this._leftPanel.TabIndex = 0;
//
// _grid
//
this._grid.AllowUserToAddRows = false;
this._grid.AllowUserToDeleteRows = false;
this._grid.AllowUserToResizeRows = false;
this._grid.AutoGenerateColumns = false;
this._grid.BackgroundColor = System.Drawing.Color.White;
this._grid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(241)))), ((int)(((byte)(245)))));
dataGridViewCellStyle1.Font = new System.Drawing.Font("Malgun Gothic", 9.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(35)))), ((int)(((byte)(45)))));
this._grid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this._grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this._nameColumn,
this._capColumn,
this._rateColumn});
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Malgun Gothic", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(218)))), ((int)(((byte)(232)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(24)))), ((int)(((byte)(32)))));
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._grid.DefaultCellStyle = dataGridViewCellStyle2;
this._grid.Dock = System.Windows.Forms.DockStyle.Fill;
this._grid.EnableHeadersVisualStyles = false;
this._grid.Location = new System.Drawing.Point(14, 60);
this._grid.MultiSelect = false;
this._grid.Name = "_grid";
this._grid.RowHeadersVisible = false;
this._grid.RowTemplate.Height = 23;
this._grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this._grid.Size = new System.Drawing.Size(472, 656);
this._grid.TabIndex = 1;
this._grid.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.Grid_CellEndEdit);
this._grid.CellParsing += new System.Windows.Forms.DataGridViewCellParsingEventHandler(this.Grid_CellParsing);
this._grid.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.Grid_CellValidating);
this._grid.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.Grid_DataError);
//
// _nameColumn
//
this._nameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this._nameColumn.DataPropertyName = "Name";
this._nameColumn.FillWeight = 130F;
this._nameColumn.HeaderText = "업종";
this._nameColumn.Name = "_nameColumn";
this._nameColumn.ReadOnly = true;
//
// _capColumn
//
this._capColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this._capColumn.DataPropertyName = "MarketCap";
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle3.Format = "N0";
this._capColumn.DefaultCellStyle = dataGridViewCellStyle3;
this._capColumn.FillWeight = 90F;
this._capColumn.HeaderText = "시가총액";
this._capColumn.Name = "_capColumn";
//
// _rateColumn
//
this._rateColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this._rateColumn.DataPropertyName = "ChangeRate";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle4.Format = "+0.00;-0.00;0.00";
this._rateColumn.DefaultCellStyle = dataGridViewCellStyle4;
this._rateColumn.FillWeight = 90F;
this._rateColumn.HeaderText = "등락률(%)";
this._rateColumn.Name = "_rateColumn";
//
// _toolbar
//
this._toolbar.Controls.Add(this._randomButton);
this._toolbar.Controls.Add(this._saveButton);
this._toolbar.Dock = System.Windows.Forms.DockStyle.Top;
this._toolbar.FlowDirection = System.Windows.Forms.FlowDirection.LeftToRight;
this._toolbar.Location = new System.Drawing.Point(14, 14);
this._toolbar.Name = "_toolbar";
this._toolbar.Size = new System.Drawing.Size(472, 46);
this._toolbar.TabIndex = 0;
this._toolbar.WrapContents = false;
//
// _randomButton
//
this._randomButton.Location = new System.Drawing.Point(3, 3);
this._randomButton.Name = "_randomButton";
this._randomButton.Size = new System.Drawing.Size(110, 32);
this._randomButton.TabIndex = 0;
this._randomButton.Text = "랜덤 값";
this._randomButton.UseVisualStyleBackColor = true;
this._randomButton.Click += new System.EventHandler(this.RandomButton_Click);
//
// _saveButton
//
this._saveButton.Location = new System.Drawing.Point(119, 3);
this._saveButton.Name = "_saveButton";
this._saveButton.Size = new System.Drawing.Size(110, 32);
this._saveButton.TabIndex = 1;
this._saveButton.Text = "PNG 저장";
this._saveButton.UseVisualStyleBackColor = true;
this._saveButton.Click += new System.EventHandler(this.SaveButton_Click);
//
// _statusLabel
//
this._statusLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
this._statusLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(86)))), ((int)(((byte)(96)))));
this._statusLabel.Location = new System.Drawing.Point(14, 716);
this._statusLabel.Name = "_statusLabel";
this._statusLabel.Size = new System.Drawing.Size(472, 30);
this._statusLabel.TabIndex = 2;
this._statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// _previewPanel
//
this._previewPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(32)))), ((int)(((byte)(39)))));
this._previewPanel.Controls.Add(this._previewBox);
this._previewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._previewPanel.Location = new System.Drawing.Point(0, 0);
this._previewPanel.Name = "_previewPanel";
this._previewPanel.Padding = new System.Windows.Forms.Padding(14);
this._previewPanel.Size = new System.Drawing.Size(776, 760);
this._previewPanel.TabIndex = 0;
//
// _previewBox
//
this._previewBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(22)))), ((int)(((byte)(28)))));
this._previewBox.Dock = System.Windows.Forms.DockStyle.Fill;
this._previewBox.Location = new System.Drawing.Point(14, 14);
this._previewBox.Name = "_previewBox";
this._previewBox.Size = new System.Drawing.Size(748, 732);
this._previewBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this._previewBox.TabIndex = 0;
this._previewBox.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(246)))), ((int)(((byte)(248)))));
this.ClientSize = new System.Drawing.Size(1280, 760);
this.Controls.Add(this._splitContainer);
this.Font = new System.Drawing.Font("Malgun Gothic", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.MinimumSize = new System.Drawing.Size(1116, 739);
this.Name = "Form1";
this.Text = "업종별 증시 이미지 생성기";
this._splitContainer.Panel1.ResumeLayout(false);
this._splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._splitContainer)).EndInit();
this._splitContainer.ResumeLayout(false);
this._leftPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._grid)).EndInit();
this._toolbar.ResumeLayout(false);
this._previewPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._previewBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer _splitContainer;
private System.Windows.Forms.Panel _leftPanel;
private System.Windows.Forms.DataGridView _grid;
private System.Windows.Forms.DataGridViewTextBoxColumn _nameColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn _capColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn _rateColumn;
private System.Windows.Forms.FlowLayoutPanel _toolbar;
private System.Windows.Forms.Button _randomButton;
private System.Windows.Forms.Button _saveButton;
private System.Windows.Forms.Label _statusLabel;
private System.Windows.Forms.Panel _previewPanel;
private System.Windows.Forms.PictureBox _previewBox;
}
}

View File

@@ -13,18 +13,18 @@ namespace mbn_stock
{
private readonly BindingList<SectorHeatMapItem> _items = new BindingList<SectorHeatMapItem>();
private readonly Random _random = new Random();
private DataGridView _grid;
private PictureBox _previewBox;
private Button _randomButton;
private Button _saveButton;
private Label _statusLabel;
private bool _loading;
public Form1()
{
InitializeComponent();
BuildUi();
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
return;
}
_grid.DataSource = _items;
LoadDefaultItems();
RandomizeValues();
}
@@ -40,124 +40,6 @@ namespace mbn_stock
base.OnFormClosed(e);
}
private void BuildUi()
{
Font = new Font("Malgun Gothic", 9.5f, FontStyle.Regular, GraphicsUnit.Point);
BackColor = Color.FromArgb(245, 246, 248);
MinimumSize = new Size(1100, 700);
SplitContainer splitContainer = new SplitContainer();
splitContainer.Size = new Size(Math.Max(ClientSize.Width, MinimumSize.Width), Math.Max(ClientSize.Height, MinimumSize.Height));
splitContainer.Dock = DockStyle.Fill;
splitContainer.FixedPanel = FixedPanel.Panel1;
splitContainer.Panel1MinSize = 420;
splitContainer.Panel2MinSize = 520;
splitContainer.SplitterDistance = 500;
splitContainer.BackColor = Color.FromArgb(210, 214, 220);
Panel leftPanel = new Panel();
leftPanel.Dock = DockStyle.Fill;
leftPanel.Padding = new Padding(14);
leftPanel.BackColor = Color.White;
FlowLayoutPanel toolbar = new FlowLayoutPanel();
toolbar.Dock = DockStyle.Top;
toolbar.Height = 46;
toolbar.FlowDirection = FlowDirection.LeftToRight;
toolbar.WrapContents = false;
_randomButton = new Button();
_randomButton.Text = "랜덤 값";
_randomButton.Width = 110;
_randomButton.Height = 32;
_randomButton.Click += RandomButton_Click;
_saveButton = new Button();
_saveButton.Text = "PNG 저장";
_saveButton.Width = 110;
_saveButton.Height = 32;
_saveButton.Click += SaveButton_Click;
toolbar.Controls.Add(_randomButton);
toolbar.Controls.Add(_saveButton);
_grid = new DataGridView();
_grid.Dock = DockStyle.Fill;
_grid.AutoGenerateColumns = false;
_grid.AllowUserToAddRows = false;
_grid.AllowUserToDeleteRows = false;
_grid.AllowUserToResizeRows = false;
_grid.RowHeadersVisible = false;
_grid.SelectionMode = DataGridViewSelectionMode.CellSelect;
_grid.MultiSelect = false;
_grid.BackgroundColor = Color.White;
_grid.BorderStyle = BorderStyle.FixedSingle;
_grid.EnableHeadersVisualStyles = false;
_grid.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(238, 241, 245);
_grid.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(30, 35, 45);
_grid.ColumnHeadersDefaultCellStyle.Font = new Font(Font, FontStyle.Bold);
_grid.DefaultCellStyle.SelectionBackColor = Color.FromArgb(218, 232, 255);
_grid.DefaultCellStyle.SelectionForeColor = Color.FromArgb(20, 24, 32);
_grid.DataError += Grid_DataError;
_grid.CellEndEdit += Grid_CellEndEdit;
_grid.CellParsing += Grid_CellParsing;
_grid.CellValidating += Grid_CellValidating;
DataGridViewTextBoxColumn nameColumn = new DataGridViewTextBoxColumn();
nameColumn.DataPropertyName = "Name";
nameColumn.HeaderText = "업종";
nameColumn.ReadOnly = true;
nameColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
nameColumn.FillWeight = 130f;
DataGridViewTextBoxColumn capColumn = new DataGridViewTextBoxColumn();
capColumn.DataPropertyName = "MarketCap";
capColumn.HeaderText = "시가총액";
capColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
capColumn.FillWeight = 90f;
capColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
capColumn.DefaultCellStyle.Format = "N0";
DataGridViewTextBoxColumn rateColumn = new DataGridViewTextBoxColumn();
rateColumn.DataPropertyName = "ChangeRate";
rateColumn.HeaderText = "등락률(%)";
rateColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
rateColumn.FillWeight = 90f;
rateColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
rateColumn.DefaultCellStyle.Format = "+0.00;-0.00;0.00";
_grid.Columns.Add(nameColumn);
_grid.Columns.Add(capColumn);
_grid.Columns.Add(rateColumn);
_grid.DataSource = _items;
_statusLabel = new Label();
_statusLabel.Dock = DockStyle.Bottom;
_statusLabel.Height = 30;
_statusLabel.TextAlign = ContentAlignment.MiddleLeft;
_statusLabel.ForeColor = Color.FromArgb(80, 86, 96);
leftPanel.Controls.Add(_grid);
leftPanel.Controls.Add(toolbar);
leftPanel.Controls.Add(_statusLabel);
Panel previewPanel = new Panel();
previewPanel.Dock = DockStyle.Fill;
previewPanel.Padding = new Padding(14);
previewPanel.BackColor = Color.FromArgb(29, 32, 39);
_previewBox = new PictureBox();
_previewBox.Dock = DockStyle.Fill;
_previewBox.BackColor = Color.FromArgb(20, 22, 28);
_previewBox.SizeMode = PictureBoxSizeMode.Zoom;
previewPanel.Controls.Add(_previewBox);
splitContainer.Panel1.Controls.Add(leftPanel);
splitContainer.Panel2.Controls.Add(previewPanel);
Controls.Add(splitContainer);
}
private void LoadDefaultItems()
{
_loading = true;