728x90
반응형
728x170
▶ MainForm.cs
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();
ResizeRedraw = true;
#region 이벤트를 설정한다.
Paint += Form_Paint;
#endregion
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
//////////////////////////////////////////////////////////////////////////////// Event
#region 폼 로드시 처리하기 - Form_Paint(sender, e)
/// <summary>
/// 폼 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Form_Paint(object sender, PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath graphicsPath = new GraphicsPath(FillMode.Alternate);
using(FontFamily fontFamily = new FontFamily("Times New Roman"))
{
using(StringFormat stringFormat = new StringFormat())
{
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
graphicsPath.AddString
(
"Outline Text",
fontFamily,
(int)FontStyle.Bold,
100,
ClientRectangle,
stringFormat
);
}
}
e.Graphics.FillPath(Brushes.Blue, graphicsPath);
using(Pen pen = new Pen(Color.Black, 3))
{
e.Graphics.DrawPath(pen, graphicsPath);
}
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 비교차 스타 그리기 (0) | 2018.12.09 |
---|---|
[C#/WINFORM] GroupBox 클래스 : 체크 그룹 박스 사용하기 (0) | 2018.12.09 |
[C#/WINFORM] ToolStripButton 클래스 : 라디오 버튼 사용하기 (0) | 2018.12.09 |
[C#/WINFORM] ListView 클래스 : 그룹 사용하기 (0) | 2018.12.08 |
[C#/WINFORM] 임의의 선으로 채워진 텍스트 그리기 (0) | 2018.12.08 |
[C#/WINFORM] 부드러운 소용돌이 프랙탈(Smooth Vortex Fractal) 그리기 (0) | 2018.12.08 |
[C#/WINFORM] 소용돌이 프랙탈(Vortex Fractal) 그리기 (0) | 2018.12.08 |
[C#/WINFORM] 소용돌이 모양 프랙탈(Curlicue Fractal) 그리기 (0) | 2018.12.08 |
[C#/WINFORM] 폰트 메트릭(Font Metrics) 구하기 (0) | 2018.12.08 |
[C#/WINFORM] 문자 크기 측정하기 (0) | 2018.12.08 |
댓글을 달아 주세요