728x90
728x170
▶ MainForm.cs
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : Form
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
#region 이벤트를 설정한다.
Load += Form_Load;
this.closeButton.Click += closeButton_Click;
#endregion
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
//////////////////////////////////////////////////////////////////////////////// Event
#region 폼 로드시 처리하기 - Form_Load(sender, e)
/// <summary>
/// 폼 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Form_Load(object sender, EventArgs e)
{
PointF[] pointArray = new PointF[10];
float centerX = (float)(ClientSize.Width * 0.5 );
float centerY = (float)(ClientSize.Height * 0.5 );
float radius1 = (float)(ClientSize.Height * 0.45);
float radius2 = (float)(ClientSize.Height * 0.25);
float theta = (float)(-Math.PI / 2);
float dtheta = (float)(2 * Math.PI / 10);
for(int i = 0; i < 10; i += 2)
{
pointArray[i] = new PointF
(
(float)(centerX + radius1 * Math.Cos(theta)),
(float)(centerY + radius1 * Math.Sin(theta))
);
theta += dtheta;
pointArray[i + 1] = new PointF
(
(float)(centerX + radius2 * Math.Cos(theta)),
(float)(centerY + radius2 * Math.Sin(theta))
);
theta += dtheta;
}
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddPolygon(pointArray);
Region region = new Region(graphicsPath);
Region = region;
}
#endregion
#region 닫기 버튼 클릭시 처리하기 - closeButton_Click(sender, e)
/// <summary>
/// 닫기 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void closeButton_Click(object sender, EventArgs e)
{
Close();
}
#endregion
}
}
728x90
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 라인 에디터 사용하기 (0) | 2018.12.13 |
---|---|
[C#/WINFORM] 확대 창 사용하기 (0) | 2018.12.13 |
[C#/WINFORM] 2D/3D 테두리 그리기 (0) | 2018.12.13 |
[C#/WINFORM] 소수 프랙탈(Prime Number Fractal) 그리기 (0) | 2018.12.11 |
[C#/WINFORM] PictureBox 클래스 : 이미지 드래그 하기 (0) | 2018.12.11 |
[C#/WINFORM] TextureBrush 클래스 사용하기 (0) | 2018.12.10 |
[C#/WINFORM] 영역 채우기(Flood Fill) (0) | 2018.12.10 |
[C#/WINFORM] 유니코드 문자 조회하기 (0) | 2018.12.09 |
[C#/WINFORM] 움직이는 GIF 이미지 사용하기 (0) | 2018.12.09 |
[C#/WINFORM] 시어핀스키 가스켓(Sierpinski Gasket) 그리기 (0) | 2018.12.09 |