main
syneffort 2 years ago
parent 274d5e186f
commit 6f20377c65
  1. 8
      LottoPicker/LottoPicker/CustomControl/BallControl.cs
  2. 13
      LottoPicker/LottoPicker/CustomControl/BallSelectControl.Designer.cs
  3. 2
      LottoPicker/LottoPicker/CustomControl/BallSelectControl.cs
  4. 125
      LottoPicker/LottoPicker/MainForm.Designer.cs
  5. 3
      LottoPicker/LottoPicker/MainForm.cs
  6. 4
      LottoPicker/LottoPicker/Properties/AssemblyInfo.cs
  7. 6
      LottoPicker/LottoPicker/Utility/Utils.cs

@ -53,7 +53,7 @@ namespace LottoPicker.CustomControl
g.DrawEllipse(pen, margin, margin, this.Width - margin * 2, this.Height - margin * 2);
g.FillEllipse(brush, margin, margin, this.Width - margin * 2, this.Height - margin * 2);
// 텍스트 그리기
// 텍스트용 공 그리기
float halfWidth = this.Width / 2;
float halfHeight = this.Height / 2;
float centerEllipsRadius = this.Width / 4;
@ -61,9 +61,9 @@ namespace LottoPicker.CustomControl
g.FillEllipse(new SolidBrush(Color.White), halfWidth - centerEllipsRadius, halfHeight - centerEllipsRadius, 2 * centerEllipsRadius, 2 * centerEllipsRadius);
// 텍스트 그리기
float factor = _ballNumber.Length == 1 ? 2f : 3f;
float halfFontSize = centerEllipsRadius / factor;
g.DrawString(_ballNumber, new Font("Malgun Gothic", halfFontSize * factor, FontStyle.Bold), new SolidBrush(Color.Black), halfWidth - halfFontSize * factor, halfHeight - halfFontSize * factor);
float factor = _ballNumber.Length == 1 ? 2f : 1f;
float fontSize = centerEllipsRadius * 0.8f;
g.DrawString(_ballNumber, new Font("Malgun Gothic", fontSize, FontStyle.Bold), new SolidBrush(Color.Black), halfWidth - fontSize / factor, halfHeight - fontSize);
}
}
}

@ -35,6 +35,7 @@
// cboType
//
this.cboType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboType.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.cboType.FormattingEnabled = true;
this.cboType.Items.AddRange(new object[] {
"노랑",
@ -42,9 +43,9 @@
"빨강",
"회색",
"초록"});
this.cboType.Location = new System.Drawing.Point(12, 12);
this.cboType.Location = new System.Drawing.Point(19, 14);
this.cboType.Name = "cboType";
this.cboType.Size = new System.Drawing.Size(100, 20);
this.cboType.Size = new System.Drawing.Size(185, 23);
this.cboType.TabIndex = 0;
//
// ctrBall
@ -52,19 +53,19 @@
this.ctrBall.BackColor = System.Drawing.Color.White;
this.ctrBall.BallColor = System.Drawing.Color.Black;
this.ctrBall.BallNumber = "0";
this.ctrBall.Location = new System.Drawing.Point(12, 59);
this.ctrBall.Location = new System.Drawing.Point(19, 60);
this.ctrBall.Name = "ctrBall";
this.ctrBall.Size = new System.Drawing.Size(100, 100);
this.ctrBall.Size = new System.Drawing.Size(185, 185);
this.ctrBall.TabIndex = 1;
//
// BallSelectControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.ctrBall);
this.Controls.Add(this.cboType);
this.Controls.Add(this.ctrBall);
this.Name = "BallSelectControl";
this.Size = new System.Drawing.Size(122, 178);
this.Size = new System.Drawing.Size(225, 262);
this.ResumeLayout(false);
}

@ -18,6 +18,8 @@ namespace LottoPicker.CustomControl
InitializeComponent();
cboType.SelectedIndex = 0;
ctrBall.Visible = false;
this.DoubleBuffered = true;
}
public void Pick()

@ -29,104 +29,155 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.button1 = new System.Windows.Forms.Button();
this.ballSelectControl1 = new LottoPicker.CustomControl.BallSelectControl();
this.ballSelectControl2 = new LottoPicker.CustomControl.BallSelectControl();
this.ballSelectControl3 = new LottoPicker.CustomControl.BallSelectControl();
this.ballSelectControl4 = new LottoPicker.CustomControl.BallSelectControl();
this.ballSelectControl5 = new LottoPicker.CustomControl.BallSelectControl();
this.ballSelectControl6 = new LottoPicker.CustomControl.BallSelectControl();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnGenerate = new System.Windows.Forms.Button();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 208);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(797, 45);
this.button1.TabIndex = 1;
this.button1.Text = "Generate";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ballSelectControl1
//
this.ballSelectControl1.BackColor = System.Drawing.Color.White;
this.ballSelectControl1.Location = new System.Drawing.Point(12, 12);
this.ballSelectControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ballSelectControl1.Location = new System.Drawing.Point(4, 4);
this.ballSelectControl1.Name = "ballSelectControl1";
this.ballSelectControl1.Size = new System.Drawing.Size(122, 178);
this.ballSelectControl1.TabIndex = 2;
this.ballSelectControl1.Size = new System.Drawing.Size(217, 269);
this.ballSelectControl1.TabIndex = 0;
//
// ballSelectControl2
//
this.ballSelectControl2.BackColor = System.Drawing.Color.White;
this.ballSelectControl2.Location = new System.Drawing.Point(147, 12);
this.ballSelectControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.ballSelectControl2.Location = new System.Drawing.Point(228, 4);
this.ballSelectControl2.Name = "ballSelectControl2";
this.ballSelectControl2.Size = new System.Drawing.Size(122, 178);
this.ballSelectControl2.TabIndex = 2;
this.ballSelectControl2.Size = new System.Drawing.Size(217, 269);
this.ballSelectControl2.TabIndex = 1;
//
// ballSelectControl3
//
this.ballSelectControl3.BackColor = System.Drawing.Color.White;
this.ballSelectControl3.Location = new System.Drawing.Point(282, 12);
this.ballSelectControl3.Dock = System.Windows.Forms.DockStyle.Fill;
this.ballSelectControl3.Location = new System.Drawing.Point(452, 4);
this.ballSelectControl3.Name = "ballSelectControl3";
this.ballSelectControl3.Size = new System.Drawing.Size(122, 178);
this.ballSelectControl3.Size = new System.Drawing.Size(217, 269);
this.ballSelectControl3.TabIndex = 2;
//
// ballSelectControl4
//
this.ballSelectControl4.BackColor = System.Drawing.Color.White;
this.ballSelectControl4.Location = new System.Drawing.Point(417, 12);
this.ballSelectControl4.Dock = System.Windows.Forms.DockStyle.Fill;
this.ballSelectControl4.Location = new System.Drawing.Point(676, 4);
this.ballSelectControl4.Name = "ballSelectControl4";
this.ballSelectControl4.Size = new System.Drawing.Size(122, 178);
this.ballSelectControl4.TabIndex = 2;
this.ballSelectControl4.Size = new System.Drawing.Size(217, 269);
this.ballSelectControl4.TabIndex = 3;
//
// ballSelectControl5
//
this.ballSelectControl5.BackColor = System.Drawing.Color.White;
this.ballSelectControl5.Location = new System.Drawing.Point(552, 12);
this.ballSelectControl5.Dock = System.Windows.Forms.DockStyle.Fill;
this.ballSelectControl5.Location = new System.Drawing.Point(900, 4);
this.ballSelectControl5.Name = "ballSelectControl5";
this.ballSelectControl5.Size = new System.Drawing.Size(122, 178);
this.ballSelectControl5.TabIndex = 2;
this.ballSelectControl5.Size = new System.Drawing.Size(217, 269);
this.ballSelectControl5.TabIndex = 4;
//
// ballSelectControl6
//
this.ballSelectControl6.BackColor = System.Drawing.Color.White;
this.ballSelectControl6.Location = new System.Drawing.Point(687, 12);
this.ballSelectControl6.Dock = System.Windows.Forms.DockStyle.Fill;
this.ballSelectControl6.Location = new System.Drawing.Point(1124, 4);
this.ballSelectControl6.Name = "ballSelectControl6";
this.ballSelectControl6.Size = new System.Drawing.Size(122, 178);
this.ballSelectControl6.TabIndex = 2;
this.ballSelectControl6.Size = new System.Drawing.Size(223, 269);
this.ballSelectControl6.TabIndex = 5;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.btnGenerate, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1357, 343);
this.tableLayoutPanel1.TabIndex = 3;
//
// btnGenerate
//
this.btnGenerate.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnGenerate.Location = new System.Drawing.Point(3, 286);
this.btnGenerate.Name = "btnGenerate";
this.btnGenerate.Size = new System.Drawing.Size(1351, 54);
this.btnGenerate.TabIndex = 3;
this.btnGenerate.Text = "Generate";
this.btnGenerate.UseVisualStyleBackColor = true;
this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click);
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
this.tableLayoutPanel2.ColumnCount = 6;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.Controls.Add(this.ballSelectControl1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.ballSelectControl6, 5, 0);
this.tableLayoutPanel2.Controls.Add(this.ballSelectControl2, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.ballSelectControl5, 4, 0);
this.tableLayoutPanel2.Controls.Add(this.ballSelectControl3, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.ballSelectControl4, 3, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1351, 277);
this.tableLayoutPanel2.TabIndex = 2;
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(824, 265);
this.Controls.Add(this.ballSelectControl6);
this.Controls.Add(this.ballSelectControl5);
this.Controls.Add(this.ballSelectControl4);
this.Controls.Add(this.ballSelectControl3);
this.Controls.Add(this.ballSelectControl2);
this.Controls.Add(this.ballSelectControl1);
this.Controls.Add(this.button1);
this.ClientSize = new System.Drawing.Size(1357, 343);
this.Controls.Add(this.tableLayoutPanel1);
this.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(1373, 382);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(1373, 382);
this.Name = "MainForm";
this.Text = "Lotto Picker";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
private CustomControl.BallSelectControl ballSelectControl1;
private CustomControl.BallSelectControl ballSelectControl2;
private CustomControl.BallSelectControl ballSelectControl3;
private CustomControl.BallSelectControl ballSelectControl4;
private CustomControl.BallSelectControl ballSelectControl5;
private CustomControl.BallSelectControl ballSelectControl6;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button btnGenerate;
}
}

@ -15,9 +15,10 @@ namespace LottoPicker
public MainForm()
{
InitializeComponent();
this.DoubleBuffered = true;
}
private void button1_Click(object sender, EventArgs e)
private void btnGenerate_Click(object sender, EventArgs e)
{
ballSelectControl1.Pick();
ballSelectControl2.Pick();

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

@ -19,9 +19,13 @@ namespace LottoPicker.Utility
Color.FromArgb(0, 148, 115),
};
private static int _callCount = 1;
// 1-10, 11-20, 21-30, 31-40, 41-45
public static int GetNumber(int index)
{
if (_callCount > int.MaxValue / 2)
_callCount = 1;
int min = 1;
int max = 46;
switch (index)
@ -50,7 +54,7 @@ namespace LottoPicker.Utility
break;
}
Random rand = new Random();
Random rand = new Random(unchecked((int)DateTime.Now.Ticks) + _callCount);
return rand.Next(min, max);
}
}

Loading…
Cancel
Save